Skip to content

Commit 513d9bf

Browse files
authored
Merge pull request #139 from OpenVoxProject/remove_initial_message
Remove first run welcome message
2 parents 3d58961 + 1595c66 commit 513d9bf

4 files changed

Lines changed: 0 additions & 114 deletions

File tree

lib/bolt/cli.rb

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@ def parse
106106
# help text
107107
options[:subcommand] = nil unless COMMANDS.include?(options[:subcommand])
108108

109-
if Bolt::Util.first_run?
110-
FileUtils.touch(Bolt::Util.first_runs_free)
111-
112-
if options[:subcommand].nil? && $stdout.isatty
113-
welcome_message
114-
raise Bolt::CLIExit
115-
end
116-
end
117-
118109
# Update the parser for the subcommand (or lack thereof)
119110
parser.update
120111
puts parser.help
@@ -165,52 +156,6 @@ def parse
165156
end
166157
end
167158

168-
# TODO: Move this to the parser.
169-
#
170-
# Print a welcome message when users first install Bolt and run `bolt`,
171-
# `bolt help` or `bolt --help`.
172-
#
173-
private def welcome_message
174-
bolt = <<~BOLT
175-
`.::-`
176-
`.-:///////-.`
177-
`-:////:. `-:///:- /ooo. .ooo/
178-
`.-:///::///:-` `-//: ymmm- :mmmy .---.
179-
:///:-. `.:////. -//: ymmm- :mmmy +mmm+
180-
://. ///. -//: ymmm--/++/- `-/++/:` :mmmy-:smmms::-
181-
://. ://. .://: ymmmdmmmmmmdo` .smmmmmmmmh: :mmmysmmmmmmmms
182-
://. ://:///:-. ymmmh/--/hmmmy -mmmd/-.:hmmm+:mmmy.-smmms--.
183-
://:.` .-////:-` ymmm- ymmm:hmmm- `dmmm/mmmy +mmm+
184-
`-:///:-..:///:-.` ymmm- ommm/dmmm` hmmm+mmmy +mmm+
185-
`.-:////:-` ymmm+ /mmmm.ommms` /mmmh:mmmy +mmmo
186-
`-.` ymmmmmhhmmmmd: ommmmhydmmmy`:mmmy -mmmmdhd
187-
oyyy+shddhs/` .+shddhy+- -yyyo .ohddhs
188-
189-
190-
BOLT
191-
example_cmd = if Bolt::Util.windows?
192-
"Invoke-BoltCommand -Command 'hostname' -Targets localhost"
193-
else
194-
"bolt command run 'hostname' --target localhost"
195-
end
196-
prev_cmd = String.new("bolt")
197-
prev_cmd << " #{@argv[0]}" unless @argv.empty?
198-
199-
message = <<~MSG
200-
🎉 Welcome to OpenBolt #{VERSION}
201-
😌 We're here to help bring order to the chaos
202-
📖 Find our documentation at https://bolt.guide
203-
🙋 Ask a question in #bolt on https://slack.puppet.com/
204-
🔩 Contribute at https://github.com/puppetlabs/bolt/
205-
💡 Not sure where to start? Try "#{example_cmd}"
206-
207-
We only print this message once. Run "#{prev_cmd}" again for help text.
208-
MSG
209-
210-
$stdout.print "\033[36m#{bolt}\033[0m"
211-
$stdout.print message
212-
end
213-
214159
# TODO: Move this to the parser.
215160
#
216161
# Validate the command. Ensure that the subcommand and action are

lib/bolt/util.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,6 @@ def read_optional_yaml_hash(path, file_name)
8080
File.exist?(path) ? read_yaml_hash(path, file_name) : {}
8181
end
8282

83-
def first_runs_free
84-
# If this fails, use the system path instead
85-
FileUtils.mkdir_p(Bolt::Config.user_path)
86-
Bolt::Config.user_path + '.first_runs_free'
87-
rescue StandardError
88-
begin
89-
# If using the system path fails, then don't bother with the welcome
90-
# message
91-
FileUtils.mkdir_p(Bolt::Config.system_path)
92-
Bolt::Config.system_path + '.first_runs_free'
93-
rescue StandardError
94-
nil
95-
end
96-
end
97-
98-
def first_run?
99-
!first_runs_free.nil? &&
100-
!File.exist?(first_runs_free)
101-
end
102-
10383
# If Puppet is loaded, we aleady have the path to the module and should
10484
# just get it. This takes the path to a file provided by the user and a
10585
# Puppet Parser scope object and tries to find the file, either as an

pwsh_module/pwsh_bolt.psm1.erb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,3 @@ end
9090

9191
}
9292
<% end %>
93-
94-
<% unless ENV['BOLT_DISABLE_PWSH_WARNING'] -%>
95-
function Write-DeprecationWarning
96-
{
97-
$FirstRunFile = "$HOME/.puppetlabs/etc/bolt/.first_runs_free"
98-
99-
if (-not(Test-Path -Path $FirstRunFile)) {
100-
New-Item -ItemType File -Path $FirstRunFile -Force -ErrorAction SilentlyContinue
101-
102-
$Warning = "The PuppetBolt PowerShell module will no longer ship with Bolt packages in a future release. ";
103-
$Warning += "Install the PuppetBolt PowerShell module from PowerShell Gallery instead using 'Import-Module PuppetBolt'."
104-
Write-Warning $Warning
105-
}
106-
}
107-
108-
Write-DeprecationWarning
109-
<% end -%>

spec/unit/util_spec.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,6 @@
186186
end
187187
end
188188

189-
describe '#first_runs_free' do
190-
it 'returns path to first run file under user-level default config dir' do
191-
expect(Bolt::Util.first_runs_free).to eq(Bolt::Config.user_path + '.first_runs_free')
192-
end
193-
194-
it 'falls back to system_path if user_path fails to be created' do
195-
expect(FileUtils).to receive(:mkdir_p)
196-
.with(Bolt::Config.user_path).and_raise(Errno::ENOENT, "No such file or directory")
197-
expect(FileUtils).to receive(:mkdir_p)
198-
.with(Bolt::Config.system_path).and_return([Bolt::Config.system_path])
199-
expect(Bolt::Util.first_runs_free).to eq(Bolt::Config.system_path + '.first_runs_free')
200-
end
201-
202-
it 'returns nil if both system_path and user_path fail to be created' do
203-
expect(FileUtils).to receive(:mkdir_p)
204-
.with(Bolt::Config.user_path).and_raise(Errno::ENOENT, "No such file or directory")
205-
expect(FileUtils).to receive(:mkdir_p)
206-
.with(Bolt::Config.system_path).and_raise(Errno::ENOENT, "No such file or directory")
207-
expect(Bolt::Util.first_runs_free).to eq(nil)
208-
end
209-
end
210-
211189
describe '#prompt_yes_no' do
212190
let(:outputter) { double('outputter', print_prompt: nil) }
213191

0 commit comments

Comments
 (0)