Port more call sites

This commit is contained in:
Douglas Eichelberger 2023-02-24 08:42:45 -08:00
parent 2c73d4d9b7
commit eb2b990575
6 changed files with 18 additions and 13 deletions

View File

@ -231,7 +231,7 @@ module Cask
already_installed_artifacts = []
odebug "Installing artifacts"
odebug "#{artifacts.length} #{"artifact".pluralize(artifacts.length)} defined", artifacts
odebug "#{artifacts.length} #{::Utils::Inflection.pluralize("artifact", artifacts.length)} defined", artifacts
artifacts.each do |artifact|
next unless artifact.respond_to?(:install_phase)
@ -460,7 +460,7 @@ module Cask
artifacts = @cask.artifacts
odebug "Uninstalling artifacts"
odebug "#{artifacts.length} #{"artifact".pluralize(artifacts.length)} defined", artifacts
odebug "#{artifacts.length} #{::Utils::Inflection.pluralize("artifact", artifacts.length)} defined", artifacts
artifacts.each do |artifact|
if artifact.respond_to?(:uninstall_phase)

View File

@ -40,7 +40,8 @@ module Homebrew
case args.named.first
when nil, "state"
if env_vars.any?
puts "Developer mode is enabled because #{env_vars.to_sentence} #{"is".pluralize(env_vars.count)} set."
puts "Developer mode is enabled because #{env_vars.to_sentence} #{Utils::Inflection.pluralize("",
env_vars.count, plural: "are", singular: "is")} set."
elsif Homebrew::Settings.read("devcmdrun") == "true"
puts "Developer mode is enabled."
else

View File

@ -166,7 +166,7 @@ module Homebrew
if args.retry? && (@fetch_tries[f] < FETCH_MAX_TRIES)
wait = 2 ** @fetch_tries[f]
remaining = FETCH_MAX_TRIES - @fetch_tries[f]
what = "try".pluralize(remaining)
what = Utils::Inflection.pluralize("tr", remaining, plural: "ies", singular: "y")
ohai "Retrying download in #{wait}s... (#{remaining} #{what} left)"
sleep wait

View File

@ -124,7 +124,7 @@ module Homebrew
return unless HOMEBREW_CELLAR.exist?
count = Formula.racks.length
puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}"
puts "#{count} #{Utils::Inflection.pluralize("keg", count)}, #{HOMEBREW_CELLAR.dup.abv}"
end
sig { params(args: CLI::Args).void }

View File

@ -57,10 +57,10 @@ module Homebrew
command_count += tap.command_files.size
private_count += 1 if tap.private?
end
info = "#{tap_count} #{"tap".pluralize(tap_count)}"
info = "#{tap_count} #{Utils::Inflection.pluralize("tap", tap_count)}"
info += ", #{private_count} private"
info += ", #{formula_count} #{"formula".pluralize(formula_count)}"
info += ", #{command_count} #{"command".pluralize(command_count)}"
info += ", #{formula_count} #{Utils::Inflection.pluralize("formula", formula_count, plural: "e")}"
info += ", #{command_count} #{Utils::Inflection.pluralize("command", command_count)}"
info += ", #{Tap::TAP_DIRECTORY.dup.abv}" if Tap::TAP_DIRECTORY.directory?
puts info
else

View File

@ -199,7 +199,8 @@ module Homebrew
unless updated_taps.empty?
auto_update_header args: args
puts "Updated #{updated_taps.count} #{"tap".pluralize(updated_taps.count)} (#{updated_taps.to_sentence})."
puts "Updated #{updated_taps.count} #{Utils::Inflection.pluralize("tap",
updated_taps.count)} (#{updated_taps.to_sentence})."
updated = true
end
@ -584,11 +585,12 @@ class ReporterHub
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
elsif report_all
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
ohai "Modified Formulae", "Modified #{changed_formulae} #{"formula".pluralize(changed_formulae)}."
ohai "Modified Formulae",
"Modified #{changed_formulae} #{Utils::Inflection.pluralize("formula", changed_formulae, plural: "e")}."
end
if (changed_casks = select_formula_or_cask(:MC).count) && changed_casks.positive?
ohai "Modified Casks", "Modified #{changed_casks} #{"cask".pluralize(changed_casks)}."
ohai "Modified Casks", "Modified #{changed_casks} #{Utils::Inflection.pluralize("cask", changed_casks)}."
end
else
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
@ -609,12 +611,14 @@ class ReporterHub
msg = ""
if outdated_formulae.positive?
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{"formula".pluralize(outdated_formulae)}"
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{Utils::Inflection.pluralize("formula",
outdated_formulae, plural: "e")}"
end
if outdated_casks.positive?
msg += " and " if msg.present?
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{"cask".pluralize(outdated_casks)}"
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{Utils::Inflection.pluralize("cask",
outdated_casks)}"
end
return if msg.blank?