pass second argument to ohai when applicable

This commit is contained in:
EricFromCanada 2020-07-06 15:30:57 -04:00
parent a6643b4adf
commit 571179ff0e
11 changed files with 16 additions and 36 deletions

View File

@ -367,8 +367,7 @@ module Cask
resolved_paths = each_resolved_path(:trash, paths).to_a resolved_paths = each_resolved_path(:trash, paths).to_a
ohai "Trashing files:" ohai "Trashing files:", resolved_paths.map(&:first)
puts resolved_paths.map(&:first)
trash_paths(*resolved_paths.flat_map(&:last), **options) trash_paths(*resolved_paths.flat_map(&:last), **options)
end end

View File

@ -39,8 +39,8 @@ module Cask
private private
def run_installer(command: nil, verbose: false, **_options) def run_installer(command: nil, verbose: false, **_options)
ohai "Running installer for #{cask}; your password may be necessary." ohai "Running installer for #{cask}; your password may be necessary.",
ohai "Package installers may write to any location; options such as --appdir are ignored." "Package installers may write to any location; options such as --appdir are ignored."
unless path.exist? unless path.exist?
pkg = path.relative_path_from(cask.staged_path) pkg = path.relative_path_from(cask.staged_path)
pkgs = Pathname.glob(cask.staged_path/"**"/"*.pkg").map { |path| path.relative_path_from(cask.staged_path) } pkgs = Pathname.glob(cask.staged_path/"**"/"*.pkg").map { |path| path.relative_path_from(cask.staged_path) }

View File

@ -22,8 +22,8 @@ module Cask
sudo = !path.parent.writable? sudo = !path.parent.writable?
if sudo && !ENV.key?("SUDO_ASKPASS") && $stdout.tty? if sudo && !ENV.key?("SUDO_ASKPASS") && $stdout.tty?
ohai "Creating Caskroom at #{path}" ohai "Creating Caskroom directory: #{path}",
ohai "We'll set permissions properly so we won't need sudo in the future." "We'll set permissions properly so we won't need sudo in the future."
end end
SystemCommand.run("/bin/mkdir", args: ["-p", path], sudo: sudo) SystemCommand.run("/bin/mkdir", args: ["-p", path], sudo: sudo)

View File

@ -119,15 +119,11 @@ module Homebrew
print_casks = args.cask? print_casks = args.cask?
print_formulae = print_casks = true if !print_formulae && !print_casks print_formulae = print_casks = true if !print_formulae && !print_casks
if print_formulae && all_formulae.any? ohai "Formulae", Formatter.columns(all_formulae) if print_formulae && all_formulae.any?
ohai "Formulae"
puts Formatter.columns(all_formulae)
end
if print_casks && all_casks.any? if print_casks && all_casks.any?
puts if args.formula? && all_formulae.any? puts if args.formula? && all_formulae.any?
ohai "Casks" ohai "Casks", Formatter.columns(all_casks)
puts Formatter.columns(all_casks)
end end
count = all_formulae.count + all_casks.count count = all_formulae.count + all_casks.count

View File

@ -470,10 +470,7 @@ class ReporterHub
dump_formula_report :M, "Updated Formulae" dump_formula_report :M, "Updated Formulae"
else else
updated = select_formula(:M).count updated = select_formula(:M).count
if updated.positive? ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive?
ohai "Updated Formulae"
puts "Updated #{updated} #{"formula".pluralize(updated)}."
end
end end
dump_formula_report :R, "Renamed Formulae" dump_formula_report :R, "Renamed Formulae"
dump_formula_report :D, "Deleted Formulae" dump_formula_report :D, "Deleted Formulae"
@ -482,10 +479,7 @@ class ReporterHub
dump_formula_report :MC, "Updated Casks" dump_formula_report :MC, "Updated Casks"
else else
updated = select_formula(:MC).count updated = select_formula(:MC).count
if updated.positive? ohai "Updated Casks", "Updated #{updated} #{"cask".pluralize(updated)}." if updated.positive?
ohai "Updated Casks"
puts "Updated #{updated} #{"cask".pluralize(updated)}."
end
end end
dump_formula_report :DC, "Deleted Casks" dump_formula_report :DC, "Deleted Casks"
end end
@ -525,8 +519,7 @@ class ReporterHub
return if formulae.empty? return if formulae.empty?
# Dump formula list. # Dump formula list.
ohai title ohai title, Formatter.columns(formulae.sort)
puts Formatter.columns(formulae.sort)
end end
def installed?(formula) def installed?(formula)

View File

@ -214,8 +214,7 @@ module Homebrew
odebug "Overwriting existing formula at #{path}" odebug "Overwriting existing formula at #{path}"
path.delete path.delete
end end
ohai "Writing formula for #{name} from revision #{rev} to:" ohai "Writing formula for #{name} from revision #{rev} to:", path
puts path
path.write result path.write result
end end

View File

@ -59,8 +59,7 @@ module Homebrew
require "keg" require "keg"
require "cask" require "cask"
ohai "Interactive Homebrew Shell" ohai "Interactive Homebrew Shell", "Example commands available with: brew irb --examples"
puts "Example commands available with: brew irb --examples"
if args.pry? if args.pry?
Pry.start Pry.start
else else

View File

@ -276,8 +276,7 @@ module SharedEnvExtension
flags = [] flags = []
if fc if fc
ohai "Building with an alternative Fortran compiler" ohai "Building with an alternative Fortran compiler", "This is unsupported."
puts "This is unsupported."
self["F77"] ||= fc self["F77"] ||= fc
else else
if (gfortran = which("gfortran", (HOMEBREW_PREFIX/"bin").to_s)) if (gfortran = which("gfortran", (HOMEBREW_PREFIX/"bin").to_s))

View File

@ -65,9 +65,6 @@ class Mktemp
ignore_interrupts { rm_rf(tmpdir) } unless retain? ignore_interrupts { rm_rf(tmpdir) } unless retain?
end end
ensure ensure
if retain? && !@tmpdir.nil? && !@quiet ohai "Temporary files retained at:", @tmpdir.to_s if retain? && !@tmpdir.nil? && !@quiet
ohai "Kept temporary files"
puts "Temporary files retained at #{@tmpdir}"
end
end end
end end

View File

@ -127,8 +127,7 @@ class Sandbox
end end
if @failed && Homebrew::EnvConfig.verbose? if @failed && Homebrew::EnvConfig.verbose?
ohai "Sandbox log" ohai "Sandbox log", logs
puts logs
$stdout.flush # without it, brew test-bot would fail to catch the log $stdout.flush # without it, brew test-bot would fail to catch the log
end end
end end

View File

@ -194,8 +194,7 @@ module UnpackStrategy
) )
if verbose && !(eula_text = without_eula.stdout).empty? if verbose && !(eula_text = without_eula.stdout).empty?
ohai "Software License Agreement for '#{path}':" ohai "Software License Agreement for '#{path}':", eula_text
puts eula_text
end end
with_eula.plist with_eula.plist