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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -335,7 +335,8 @@ module Homebrew
<<~EOS <<~EOS
#{HOMEBREW_TEMP} is world-writable but does not have the sticky bit set. #{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 EOS
end end
alias generic_check_tmpdir_sticky_bit check_tmpdir_sticky_bit alias generic_check_tmpdir_sticky_bit check_tmpdir_sticky_bit
@ -897,7 +898,8 @@ module Homebrew
<<~EOS <<~EOS
The staging path #{user_tilde(path.to_s)} is not writable by the current user. 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 EOS
end end
@ -970,12 +972,14 @@ module Homebrew
if result.include? "Python 2.7" if result.include? "Python 2.7"
<<~EOS <<~EOS
Your Python installation has a broken version of setuptools. 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 EOS
else else
<<~EOS <<~EOS
The system Python version is wrong. 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 EOS
end end
elsif result.stderr.include? "pkg_resources.DistributionNotFound" elsif result.stderr.include? "pkg_resources.DistributionNotFound"

View File

@ -362,14 +362,16 @@ class FormulaInstaller
EOS EOS
if formula.outdated? && !formula.head? if formula.outdated? && !formula.head?
message += <<~EOS 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 EOS
elsif only_deps? elsif only_deps?
message = nil message = nil
else else
# some other version is already installed *and* linked # some other version is already installed *and* linked
message += <<~EOS 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 EOS
end end
raise CannotInstallFormulaError, message if message raise CannotInstallFormulaError, message if message
@ -805,7 +807,8 @@ class FormulaInstaller
if build_bottle? if build_bottle?
ohai "Not running post_install as we're building a 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 else
post_install post_install
end end
@ -1097,7 +1100,8 @@ class FormulaInstaller
end end
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The post-install step did not complete successfully" 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? odebug e, e.backtrace, always_display: Homebrew::EnvConfig.developer?
Homebrew.failed = true Homebrew.failed = true
@show_summary_heading = true @show_summary_heading = true

View File

@ -17,8 +17,8 @@ class Migrator
class MigrationNeededError < RuntimeError class MigrationNeededError < RuntimeError
def initialize(formula) def initialize(formula)
super <<~EOS super <<~EOS
#{formula.oldname} was renamed to #{formula.name} and needs to be migrated. #{formula.oldname} was renamed to #{formula.name} and needs to be migrated by running:
Please run `brew migrate #{formula.oldname}` brew migrate #{formula.oldname}
EOS EOS
end end
end end
@ -48,7 +48,8 @@ class Migrator
super <<~EOS super <<~EOS
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap || "path or url"}. #{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 EOS
end end
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 it "shows a message prompting to run the installer manually" do
expect { expect {
installer.install_phase(command: command) 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
end end

View File

@ -119,7 +119,7 @@ describe Cask::Installer, :cask do
==> Installing Cask with-installer-manual ==> Installing Cask with-installer-manual
To complete the installation of Cask with-installer-manual, you must also To complete the installation of Cask with-installer-manual, you must also
run the installer at: 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! 🍺 with-installer-manual was successfully installed!
EOS EOS
).to_stdout ).to_stdout

View File

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

View File

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