indent suggested commands on subsequent line

and combine sequential puts calls
This commit is contained in:
EricFromCanada 2021-01-24 21:25:12 -05:00
parent 2ae4f11963
commit cd3cb6928b
14 changed files with 76 additions and 42 deletions

View File

@ -153,13 +153,17 @@ class Build
end
if args.interactive?
ohai "Entering interactive mode"
puts "Type `exit` to return and finalize the installation."
puts "Install to this prefix: #{formula.prefix}"
puts <<~EOS
Type `exit` to return and finalize the installation.
Install to this prefix: #{formula.prefix}
EOS
if args.git?
puts "This directory is now a Git repo. Make your changes and then use:"
puts " git diff | pbcopy"
puts "to copy the diff to the clipboard."
puts <<~EOS
This directory is now a Git repository. Make your changes and then use:
git diff | pbcopy
to copy the diff to the clipboard.
EOS
end
interactive_shell(formula)

View File

@ -23,7 +23,7 @@ module Cask
puts <<~EOS
To complete the installation of Cask #{cask}, you must also
run the installer at:
'#{cask.staged_path.join(path)}'
#{cask.staged_path.join(path)}
EOS
end
end

View File

@ -185,7 +185,8 @@ module Homebrew
if !args.HEAD? && f.stable.nil?
odie <<~EOS
#{f.full_name} is a head-only formula
Install with `brew install --HEAD #{f.full_name}`
To install it, run:
brew install --HEAD #{f.full_name}
EOS
end
@ -208,14 +209,16 @@ module Homebrew
optlinked_version = Keg.for(f.opt_prefix).version
onoe <<~EOS
#{f.full_name} #{optlinked_version} is already installed
To upgrade to #{f.version}, run `brew upgrade #{f.full_name}`
To upgrade to #{f.version}, run:
brew upgrade #{f.full_name}
EOS
elsif args.only_dependencies?
installed_formulae << f
elsif !args.quiet?
opoo <<~EOS
#{f.full_name} #{f.pkg_version} is already installed and up-to-date
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
To reinstall #{f.pkg_version}, run:
brew reinstall #{f.name}
EOS
end
elsif (args.HEAD? && new_head_installed) || prefix_installed
@ -243,7 +246,8 @@ module Homebrew
elsif !f.linked? || f.keg_only?
msg = <<~EOS
#{msg}, it's just not linked
You can use `brew link #{f}` to link this version.
To link this version, run:
brew link #{f}
EOS
elsif args.only_dependencies?
msg = nil
@ -254,7 +258,8 @@ module Homebrew
else
<<~EOS
#{msg} and up-to-date
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
To reinstall #{f.pkg_version}, run:
brew reinstall #{f.name}
EOS
end
end
@ -264,7 +269,8 @@ module Homebrew
if !old_formula.linked? && !old_formula.keg_only?
msg = <<~EOS
#{msg}, it's just not linked.
You can use `brew link #{old_formula.full_name}` to link this version.
To link this version, run:
brew link #{old_formula.full_name}
EOS
elsif args.quiet?
msg = nil
@ -275,8 +281,10 @@ module Homebrew
# but not migrated one. If --force is passed then install anyway.
opoo <<~EOS
#{f.oldname} is already installed, it's just not migrated
You can migrate this formula with `brew migrate #{f}`
Or you can force install it with `brew install #{f} --force`
To migrate this formula, run:
brew migrate #{f}
Or to force-install it, run:
brew install #{f} --force
EOS
else
# If none of the above is true and the formula is linked, then

View File

@ -116,9 +116,11 @@ module Homebrew
end
ohai title
puts "Current formula version: #{current_version}"
puts "Latest Repology version: #{repology_latest}"
puts "Latest livecheck version: #{livecheck_latest}"
puts "Open pull requests: #{pull_requests}"
puts <<~EOS
Current formula version: #{current_version}
Latest Repology version: #{repology_latest}
Latest livecheck version: #{livecheck_latest}
Open pull requests: #{pull_requests}
EOS
end
end

View File

@ -40,10 +40,12 @@ module Homebrew
args = irb_args.parse(ARGV.dup.freeze)
if args.examples?
puts "'v8'.f # => instance of the v8 formula"
puts ":hub.f.latest_version_installed?"
puts ":lua.f.methods - 1.methods"
puts ":mpd.f.recursive_dependencies.reject(&:installed?)"
puts <<~EOS
'v8'.f # => instance of the v8 formula
:hub.f.latest_version_installed?
:lua.f.methods - 1.methods
:mpd.f.recursive_dependencies.reject(&:installed?)
EOS
return
end

View File

@ -81,8 +81,11 @@ module Homebrew
else
"Bintray"
end
puts "brew #{bottle_args.join " "}"
puts "Upload bottles described by these JSON files to #{service}:\n #{json_files.join("\n ")}"
puts <<~EOS
brew #{bottle_args.join " "}
Upload bottles described by these JSON files to #{service}:
#{json_files.join("\n ")}
EOS
return
end

View File

@ -95,8 +95,10 @@ module Homebrew
end
end
puts "Start commit: #{start_commit}"
puts " End commit: #{end_commit}"
puts <<~EOS
Start commit: #{start_commit}
End commit: #{end_commit}
EOS
mkdir "update-test"
chdir "update-test" do

View File

@ -335,7 +335,8 @@ module Homebrew
<<~EOS
#{HOMEBREW_TEMP} is world-writable but does not have the sticky bit set.
Please execute `sudo chmod +t #{HOMEBREW_TEMP}` in your Terminal.
To set it, run the following command:
sudo chmod +t #{HOMEBREW_TEMP}
EOS
end
alias generic_check_tmpdir_sticky_bit check_tmpdir_sticky_bit
@ -897,7 +898,8 @@ module Homebrew
<<~EOS
The staging path #{user_tilde(path.to_s)} is not writable by the current user.
To fix, run \'sudo chown -R $(whoami):staff #{user_tilde(path.to_s)}'
To fix, run:
sudo chown -R $(whoami):staff #{user_tilde(path.to_s)}
EOS
end
@ -970,12 +972,14 @@ module Homebrew
if result.include? "Python 2.7"
<<~EOS
Your Python installation has a broken version of setuptools.
To fix, reinstall macOS or run 'sudo /usr/bin/python -m pip install -I setuptools'.
To fix, reinstall macOS or run:
sudo /usr/bin/python -m pip install -I setuptools
EOS
else
<<~EOS
The system Python version is wrong.
To fix, run 'defaults write com.apple.versioner.python Version 2.7'.
To fix, run:
defaults write com.apple.versioner.python Version 2.7
EOS
end
elsif result.stderr.include? "pkg_resources.DistributionNotFound"

View File

@ -362,14 +362,16 @@ class FormulaInstaller
EOS
if formula.outdated? && !formula.head?
message += <<~EOS
To upgrade to #{formula.pkg_version}, run `brew upgrade #{formula.full_name}`.
To upgrade to #{formula.pkg_version}, run:
brew upgrade #{formula.full_name}
EOS
elsif only_deps?
message = nil
else
# some other version is already installed *and* linked
message += <<~EOS
To install #{formula.pkg_version}, first run `brew unlink #{formula.name}`.
To install #{formula.pkg_version}, first run:
brew unlink #{formula.name}
EOS
end
raise CannotInstallFormulaError, message if message
@ -805,7 +807,8 @@ class FormulaInstaller
if build_bottle?
ohai "Not running post_install as we're building a bottle"
puts "You can run it manually using `brew postinstall #{formula.full_name}`"
puts "You can run it manually using:"
puts " brew postinstall #{formula.full_name}"
else
post_install
end
@ -1097,7 +1100,8 @@ class FormulaInstaller
end
rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The post-install step did not complete successfully"
puts "You can try again using `brew postinstall #{formula.full_name}`"
puts "You can try again using:"
puts " brew postinstall #{formula.full_name}"
odebug e, e.backtrace, always_display: Homebrew::EnvConfig.developer?
Homebrew.failed = true
@show_summary_heading = true

View File

@ -17,8 +17,8 @@ class Migrator
class MigrationNeededError < RuntimeError
def initialize(formula)
super <<~EOS
#{formula.oldname} was renamed to #{formula.name} and needs to be migrated.
Please run `brew migrate #{formula.oldname}`
#{formula.oldname} was renamed to #{formula.name} and needs to be migrated by running:
brew migrate #{formula.oldname}
EOS
end
end
@ -48,7 +48,8 @@ class Migrator
super <<~EOS
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap || "path or url"}.
#{msg}To force migration use `brew migrate --force #{formula.oldname}`.
#{msg}To force migration, run:
brew migrate --force #{formula.oldname}
EOS
end
end

View File

@ -18,7 +18,7 @@ describe Cask::Artifact::Installer, :cask do
it "shows a message prompting to run the installer manually" do
expect {
installer.install_phase(command: command)
}.to output(%r{run the installer at:\s+'#{staged_path}/installer'}).to_stdout
}.to output(%r{run the installer at:\s+#{staged_path}/installer}).to_stdout
end
end

View File

@ -119,7 +119,7 @@ describe Cask::Installer, :cask do
==> Installing Cask with-installer-manual
To complete the installation of Cask with-installer-manual, you must also
run the installer at:
'#{with_installer_manual.staged_path.join("Caffeine.app")}'
#{with_installer_manual.staged_path.join("Caffeine.app")}
🍺 with-installer-manual was successfully installed!
EOS
).to_stdout

View File

@ -50,8 +50,11 @@ module Homebrew
if rack.directory?
versions = rack.subdirs.map(&:basename)
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
puts "Run `brew uninstall --force #{keg.name}` to remove all versions."
puts <<~EOS
#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed.
To remove all versions, run:
brew uninstall --force #{keg.name}
EOS
end
next unless f

View File

@ -36,7 +36,8 @@ module Utils
Could not link:
#{conflicts.join("\n")}
Please delete these paths and run `#{command}`.
Please delete these paths and run:
#{command}
EOS
end
private_class_method :link_src_dst_dirs