diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index ceb2c528e5..64fa081e59 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -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) diff --git a/Library/Homebrew/cmd/developer.rb b/Library/Homebrew/cmd/developer.rb index e967844b7a..a142a77f7d 100755 --- a/Library/Homebrew/cmd/developer.rb +++ b/Library/Homebrew/cmd/developer.rb @@ -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 diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 5bbe534ee7..80af3a5200 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -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 diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 22326122d3..68982834d8 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -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 } diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index f72c611abd..270892c7ec 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -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 diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 69b2efeb5d..d4a8f4cbec 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -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?