diff --git a/Library/Homebrew/cask/cmd/install.rb b/Library/Homebrew/cask/cmd/install.rb index efd84d9365..d8b18c0750 100644 --- a/Library/Homebrew/cask/cmd/install.rb +++ b/Library/Homebrew/cask/cmd/install.rb @@ -85,8 +85,7 @@ module Cask if dry_run if (casks_to_install = casks.reject(&:installed?).presence) - plural = ::Utils.pluralize("cask", casks_to_install.count) - ohai "Would install #{casks_to_install.count} #{plural}:" + ohai "Would install #{::Utils.pluralize("cask", casks_to_install.count, includecount: true)}:" puts casks_to_install.map(&:full_name).join(" ") end casks.each do |cask| @@ -97,8 +96,8 @@ module Cask .map(&:name) next if dep_names.blank? - plural = ::Utils.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y") - ohai "Would install #{dep_names.count} #{plural} for #{cask.full_name}:" + ohai "Would install #{::Utils.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y", + includecount: true)} for #{cask.full_name}:" puts dep_names.join(" ") end return diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 1a231504d5..78514f5763 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -454,7 +454,7 @@ module Cask artifacts = @cask.artifacts odebug "Uninstalling artifacts" - odebug "#{artifacts.length} #{::Utils.pluralize("artifact", artifacts.length)} defined", artifacts + odebug "#{::Utils.pluralize("artifact", artifacts.length, includecount: true)} defined", artifacts artifacts.each do |artifact| if artifact.respond_to?(:uninstall_phase) diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 11fd1469cd..af98897ae2 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} #{Utils.pluralize("keg", count)}, #{HOMEBREW_CELLAR.dup.abv}" + puts "#{Utils.pluralize("keg", count, includecount: true)}, #{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 039c861dca..564ebf75e5 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} #{Utils.pluralize("tap", tap_count)}" + info = Utils.pluralize("tap", tap_count, includecount: true) info += ", #{private_count} private" - info += ", #{formula_count} #{Utils.pluralize("formula", formula_count, plural: "e")}" - info += ", #{command_count} #{Utils.pluralize("command", command_count)}" + info += ", #{Utils.pluralize("formula", formula_count, plural: "e", includecount: true)}" + info += ", #{Utils.pluralize("command", command_count, includecount: true)}" 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 3e0df64c35..dc9c4ebbe5 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -233,8 +233,7 @@ module Homebrew unless updated_taps.empty? auto_update_header args: args - noun = Utils.pluralize("tap", updated_taps.count) - puts "Updated #{updated_taps.count} #{noun} (#{updated_taps.to_sentence})." + puts "Updated #{Utils.pluralize("tap", updated_taps.count, includecount: true)} (#{updated_taps.to_sentence})." updated = true end @@ -656,12 +655,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? - noun = Utils.pluralize("formula", changed_formulae, plural: "e") - ohai "Modified Formulae", "Modified #{changed_formulae} #{noun}." + ohai "Modified Formulae", + "Modified #{Utils.pluralize("formula", changed_formulae, plural: "e", includecount: true)}." end if (changed_casks = select_formula_or_cask(:MC).count) && changed_casks.positive? - ohai "Modified Casks", "Modified #{changed_casks} #{Utils.pluralize("cask", changed_casks)}." + ohai "Modified Casks", "Modified #{Utils.pluralize("cask", changed_casks, includecount: true)}." end else outdated_formulae = Formula.installed.select(&:outdated?).map(&:name) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 15ddc1f72f..c3a98e17d1 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -275,22 +275,21 @@ module Homebrew if total_problems_count.positive? puts new_formula_problem_lines.map { |s| " #{s}" } - errors_summary = "#{total_problems_count} #{Utils.pluralize("problem", total_problems_count)}" + errors_summary = Utils.pluralize("problem", total_problems_count, includecount: true) error_sources = [] if formula_count.positive? - error_sources << "#{formula_count} #{Utils.pluralize("formula", formula_count, plural: "e")}" + error_sources << Utils.pluralize("formula", formula_count, plural: "e", includecount: true) end - error_sources << "#{cask_count} #{Utils.pluralize("cask", cask_count)}" if cask_count.positive? - error_sources << "#{tap_count} #{Utils.pluralize("tap", tap_count)}" if tap_count.positive? + error_sources << Utils.pluralize("cask", cask_count, includecount: true) if cask_count.positive? + error_sources << Utils.pluralize("tap", tap_count, includecount: true) if tap_count.positive? errors_summary += " in #{error_sources.to_sentence}" if error_sources.any? errors_summary += " detected" if corrected_problem_count.positive? - noun = Utils.pluralize("problem", corrected_problem_count) - errors_summary += ", #{corrected_problem_count} #{noun} corrected" + errors_summary += ", #{Utils.pluralize("problem", corrected_problem_count, includecount: true)} corrected" end ofail errors_summary diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index 4c3d7ace60..1512282087 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -64,8 +64,8 @@ module Homebrew results[user] = scan_repositories(repos, user, args) grand_totals[user] = total(results[user]) - user_contrib = grand_totals[user].values.sum - puts "#{user} contributed #{user_contrib} #{Utils.pluralize("time", user_contrib)} #{time_period(args)}." + puts "#{user} contributed #{Utils.pluralize("time", grand_totals[user].values.sum, + includecount: true)} #{time_period(args)}." puts generate_csv(T.must(user), results[user], grand_totals[user]) if args.csv? return end @@ -80,9 +80,8 @@ module Homebrew results[username] = scan_repositories(repos, username, args) grand_totals[username] = total(results[username]) - username_contrib = grand_totals[username].values.sum - puts "#{username} contributed #{username_contrib} #{Utils.pluralize("time", - username_contrib)} #{time_period(args)}." + puts "#{username} contributed #{Utils.pluralize("time", grand_totals[username].values.sum, + includecount: true)} #{time_period(args)}." end puts generate_maintainers_csv(grand_totals) if args.csv? diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 39ccbc58fc..dafcb4e84f 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -908,7 +908,7 @@ module Homebrew 0 end - "#{tap.path} (#{cask_count} #{Utils.pluralize("cask", cask_count)})" + "#{tap.path} (#{Utils.pluralize("cask", cask_count, includecount: true)})" end end) diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 77c7547376..75188cdd68 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -199,13 +199,13 @@ module Kernel if seconds > 59 minutes = seconds / 60 seconds %= 60 - res = +"#{minutes} #{Utils.pluralize("minute", minutes)}" + res = +Utils.pluralize("minute", minutes, includecount: true) return res.freeze if seconds.zero? res << " " end - res << "#{seconds} #{Utils.pluralize("second", seconds)}" + res << Utils.pluralize("second", seconds, includecount: true) res.freeze end diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 19a09b219e..66820d89e7 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -326,8 +326,8 @@ module Homebrew if dry_run if (formulae_name_to_install = formulae_to_install.map(&:name)) - plural = Utils.pluralize("formula", formulae_name_to_install.count, plural: "e") - ohai "Would install #{formulae_name_to_install.count} #{plural}:" + ohai "Would install #{Utils.pluralize("formula", formulae_name_to_install.count, + plural: "e", includecount: true)}:" puts formulae_name_to_install.join(" ") formula_installers.each do |fi| @@ -355,8 +355,8 @@ module Homebrew def print_dry_run_dependencies(formula, dependencies, &block) return if dependencies.empty? - plural = Utils.pluralize("dependenc", dependencies.count, plural: "ies", singular: "y") - ohai "Would install #{dependencies.count} #{plural} for #{formula.name}:" + ohai "Would install #{Utils.pluralize("dependenc", dependencies.count, plural: "ies", singular: "y", + includecount: true)} for #{formula.name}:" formula_names = dependencies.map(&:first).map(&:to_formula).map(&block) puts formula_names.join(" ") end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 457fe67726..32c86afc00 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -475,15 +475,15 @@ class Tap contents = [] if (command_count = command_files.count).positive? - contents << "#{command_count} #{Utils.pluralize("command", command_count)}" + contents << Utils.pluralize("command", command_count, includecount: true) end if (cask_count = cask_files.count).positive? - contents << "#{cask_count} #{Utils.pluralize("cask", cask_count)}" + contents << Utils.pluralize("cask", cask_count, includecount: true) end if (formula_count = formula_files.count).positive? - contents << "#{formula_count} #{Utils.pluralize("formula", formula_count, plural: "e")}" + contents << Utils.pluralize("formula", formula_count, plural: "e", includecount: true) end contents diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 83fe6329e2..03718d2d57 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -310,10 +310,10 @@ module Homebrew if upgradeable_dependents.blank? ohai "No outdated dependents to upgrade!" unless dry_run else - dependent_plural = Utils.pluralize("dependent", upgradeable_dependents.count) formula_plural = Utils.pluralize("formula", installed_formulae.count, plural: "e") upgrade_verb = dry_run ? "Would upgrade" : "Upgrading" - ohai "#{upgrade_verb} #{upgradeable_dependents.count} #{dependent_plural} of upgraded #{formula_plural}:" + ohai "#{upgrade_verb} #{Utils.pluralize("dependent", upgradeable_dependents.count, + includecount: true)} of upgraded #{formula_plural}:" Upgrade.puts_no_installed_dependents_check_disable_message_if_not_already! formulae_upgrades = upgradeable_dependents.map do |f| name = f.full_specified_name @@ -386,9 +386,8 @@ module Homebrew if reinstallable_broken_dependents.blank? ohai "No broken dependents to reinstall!" else - count = reinstallable_broken_dependents.count - plural = Utils.pluralize("dependent", reinstallable_broken_dependents.count) - ohai "Reinstalling #{count} #{plural} with broken linkage from source:" + ohai "Reinstalling #{Utils.pluralize("dependent", reinstallable_broken_dependents.count, + includecount: true)} with broken linkage from source:" Upgrade.puts_no_installed_dependents_check_disable_message_if_not_already! puts reinstallable_broken_dependents.map(&:full_specified_name) .join(", ")