git grep -l Utils::Inflection | xargs gsed -i 's|Utils::Inflection|Utils|g'

This commit is contained in:
Douglas Eichelberger 2023-02-27 20:16:34 -08:00
parent 86c500fdcc
commit 0eccc0e987
26 changed files with 56 additions and 56 deletions

View File

@ -85,7 +85,7 @@ module Cask
if dry_run
if (casks_to_install = casks.reject(&:installed?).presence)
plural = ::Utils::Inflection.pluralize("cask", casks_to_install.count)
plural = ::Utils.pluralize("cask", casks_to_install.count)
ohai "Would install #{casks_to_install.count} #{plural}:"
puts casks_to_install.map(&:full_name).join(" ")
end
@ -97,7 +97,7 @@ module Cask
.map(&:name)
next if dep_names.blank?
plural = ::Utils::Inflection.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y")
plural = ::Utils.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y")
ohai "Would install #{dep_names.count} #{plural} for #{cask.full_name}:"
puts dep_names.join(" ")
end

View File

@ -46,7 +46,7 @@ module Cask
next if (versions = cask.versions).empty?
puts <<~EOS
#{cask} #{versions.to_sentence} #{::Utils::Inflection.pluralize("", versions.count, plural: "are", singular: "is")} still installed.
#{cask} #{versions.to_sentence} #{::Utils.pluralize("", versions.count, plural: "are", singular: "is")} still installed.
Remove #{(versions.count == 1) ? "it" : "them all"} with `brew uninstall --cask --force #{cask}`.
EOS
end

View File

@ -121,7 +121,7 @@ module Cask
if manual_installer_casks.present?
count = manual_installer_casks.count
ofail "Not upgrading #{count} `installer manual` #{::Utils::Inflection.pluralize("cask", versions.count)}."
ofail "Not upgrading #{count} `installer manual` #{::Utils.pluralize("cask", versions.count)}."
puts manual_installer_casks.map(&:to_s)
outdated_casks -= manual_installer_casks
end
@ -142,7 +142,7 @@ module Cask
end
verb = dry_run ? "Would upgrade" : "Upgrading"
oh1 "#{verb} #{outdated_casks.count} outdated #{::Utils::Inflection.pluralize("package",
oh1 "#{verb} #{outdated_casks.count} outdated #{::Utils.pluralize("package",
outdated_casks.count)}:"
caught_exceptions = []

View File

@ -231,7 +231,7 @@ module Cask
already_installed_artifacts = []
odebug "Installing artifacts"
odebug "#{artifacts.length} #{::Utils::Inflection.pluralize("artifact", artifacts.length)} defined", artifacts
odebug "#{artifacts.length} #{::Utils.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} #{::Utils::Inflection.pluralize("artifact", artifacts.length)} defined", artifacts
odebug "#{artifacts.length} #{::Utils.pluralize("artifact", artifacts.length)} defined", artifacts
artifacts.each do |artifact|
if artifact.respond_to?(:uninstall_phase)

View File

@ -584,7 +584,7 @@ module Homebrew
formulae_names = removable_formulae.map(&:full_name).sort
verb = dry_run ? "Would autoremove" : "Autoremoving"
oh1 "#{verb} #{formulae_names.count} unneeded #{Utils::Inflection.pluralize("formula", formulae_names.count,
oh1 "#{verb} #{formulae_names.count} unneeded #{Utils.pluralize("formula", formulae_names.count,
plural: "e")}:"
puts formulae_names.join("\n")
return if dry_run

View File

@ -684,7 +684,7 @@ module Homebrew
arg_types = types.map { |type| type.to_s.tr("_", " ") }
.to_sentence two_words_connector: " or ", last_word_connector: " or "
"This command does not take more than #{maximum} #{arg_types} #{Utils::Inflection.pluralize("argument",
"This command does not take more than #{maximum} #{arg_types} #{Utils.pluralize("argument",
maximum)}."
end
end
@ -699,7 +699,7 @@ module Homebrew
arg_types = types.map { |type| type.to_s.tr("_", " ") }
.to_sentence two_words_connector: " or ", last_word_connector: " or "
super "This command requires at least #{minimum} #{arg_types} #{Utils::Inflection.pluralize("argument",
super "This command requires at least #{minimum} #{arg_types} #{Utils.pluralize("argument",
minimum)}."
end
end
@ -713,7 +713,7 @@ module Homebrew
arg_types = types.map { |type| type.to_s.tr("_", " ") }
.to_sentence two_words_connector: " or ", last_word_connector: " or "
super "This command requires exactly #{minimum} #{arg_types} #{Utils::Inflection.pluralize("argument",
super "This command requires exactly #{minimum} #{arg_types} #{Utils.pluralize("argument",
minimum)}."
end
end

View File

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

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 = Utils::Inflection.pluralize("tr", remaining, plural: "ies", singular: "y")
what = Utils.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} #{Utils::Inflection.pluralize("keg", count)}, #{HOMEBREW_CELLAR.dup.abv}"
puts "#{count} #{Utils.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} #{Utils::Inflection.pluralize("tap", tap_count)}"
info = "#{tap_count} #{Utils.pluralize("tap", tap_count)}"
info += ", #{private_count} private"
info += ", #{formula_count} #{Utils::Inflection.pluralize("formula", formula_count, plural: "e")}"
info += ", #{command_count} #{Utils::Inflection.pluralize("command", command_count)}"
info += ", #{formula_count} #{Utils.pluralize("formula", formula_count, plural: "e")}"
info += ", #{command_count} #{Utils.pluralize("command", command_count)}"
info += ", #{Tap::TAP_DIRECTORY.dup.abv}" if Tap::TAP_DIRECTORY.directory?
puts info
else

View File

@ -199,7 +199,7 @@ module Homebrew
unless updated_taps.empty?
auto_update_header args: args
puts "Updated #{updated_taps.count} #{Utils::Inflection.pluralize("tap",
puts "Updated #{updated_taps.count} #{Utils.pluralize("tap",
updated_taps.count)} (#{updated_taps.to_sentence})."
updated = true
end
@ -586,11 +586,11 @@ class ReporterHub
elsif report_all
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
ohai "Modified Formulae",
"Modified #{changed_formulae} #{Utils::Inflection.pluralize("formula", changed_formulae, plural: "e")}."
"Modified #{changed_formulae} #{Utils.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} #{Utils::Inflection.pluralize("cask", changed_casks)}."
ohai "Modified Casks", "Modified #{changed_casks} #{Utils.pluralize("cask", changed_casks)}."
end
else
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
@ -611,13 +611,13 @@ class ReporterHub
msg = ""
if outdated_formulae.positive?
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{Utils::Inflection.pluralize("formula",
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{Utils.pluralize("formula",
outdated_formulae, plural: "e")}"
end
if outdated_casks.positive?
msg += " and " if msg.present?
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{Utils::Inflection.pluralize("cask",
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{Utils.pluralize("cask",
outdated_casks)}"
end

View File

@ -172,7 +172,7 @@ module Homebrew
end
if !pinned.empty? && !args.ignore_pinned?
ofail "Not upgrading #{pinned.count} pinned #{Utils::Inflection.pluralize("package", pinned.count)}:"
ofail "Not upgrading #{pinned.count} pinned #{Utils.pluralize("package", pinned.count)}:"
puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
end
@ -180,7 +180,7 @@ module Homebrew
oh1 "No packages to upgrade"
else
verb = args.dry_run? ? "Would upgrade" : "Upgrading"
oh1 "#{verb} #{formulae_to_install.count} outdated #{Utils::Inflection.pluralize("package",
oh1 "#{verb} #{formulae_to_install.count} outdated #{Utils.pluralize("package",
formulae_to_install.count)}:"
formulae_upgrades = formulae_to_install.map do |f|
if f.optlinked?

View File

@ -277,22 +277,22 @@ module Homebrew
if total_problems_count.positive?
puts new_formula_problem_lines.map { |s| " #{s}" }
errors_summary = "#{total_problems_count} #{Utils::Inflection.pluralize("problem", total_problems_count)}"
errors_summary = "#{total_problems_count} #{Utils.pluralize("problem", total_problems_count)}"
error_sources = []
if formula_count.positive?
error_sources << "#{formula_count} #{Utils::Inflection.pluralize("formula", formula_count,
error_sources << "#{formula_count} #{Utils.pluralize("formula", formula_count,
plural: "e")}"
end
error_sources << "#{cask_count} #{Utils::Inflection.pluralize("cask", cask_count)}" if cask_count.positive?
error_sources << "#{tap_count} #{Utils::Inflection.pluralize("tap", tap_count)}" if tap_count.positive?
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?
errors_summary += " in #{error_sources.to_sentence}" if error_sources.any?
errors_summary += " detected"
if corrected_problem_count.positive?
errors_summary += ", #{corrected_problem_count} #{Utils::Inflection.pluralize("problem",
errors_summary += ", #{corrected_problem_count} #{Utils.pluralize("problem",
corrected_problem_count)} corrected"
end

View File

@ -61,7 +61,7 @@ module Homebrew
return
end
ohai "#{prs.count} matching pull #{Utils::Inflection.pluralize("request", prs.count)}:"
ohai "#{prs.count} matching pull #{Utils.pluralize("request", prs.count)}:"
pr_urls = []
prs.each do |pr|
puts "#{tap.full_name unless tap.core_tap?}##{pr["number"]}: #{pr["title"]}"

View File

@ -906,11 +906,11 @@ module Homebrew
0
end
"#{tap.path} (#{cask_count} #{Utils::Inflection.pluralize("cask", cask_count)})"
"#{tap.path} (#{cask_count} #{Utils.pluralize("cask", cask_count)})"
end
end)
taps = Utils::Inflection.pluralize("tap", error_tap_paths.count)
taps = Utils.pluralize("tap", error_tap_paths.count)
"Unable to read from cask #{taps}: #{error_tap_paths.to_sentence}" if error_tap_paths.present?
end

View File

@ -568,7 +568,7 @@ end
class UnbottledError < RuntimeError
def initialize(formulae)
msg = +<<~EOS
The following #{Utils::Inflection.pluralize("formula", formulae.count, plural: "e")} cannot be installed from #{Utils::Inflection.pluralize("bottle", formulae.count)} and must be
The following #{Utils.pluralize("formula", formulae.count, plural: "e")} cannot be installed from #{Utils.pluralize("bottle", formulae.count)} and must be
built from source.
#{formulae.to_sentence}
EOS

View File

@ -52,10 +52,10 @@ module Formulary
next if type == :formulary_factory
cached_objects.each_value do |klass|
namespace = Utils::Inflection.deconstantize(klass.name)
next if Utils::Inflection.deconstantize(namespace) != name
namespace = Utils.deconstantize(klass.name)
next if Utils.deconstantize(namespace) != name
remove_const(Utils::Inflection.demodulize(namespace))
remove_const(Utils.demodulize(namespace))
end
end

View File

@ -324,7 +324,7 @@ module Homebrew
if dry_run
if (formulae_name_to_install = formulae_to_install.map(&:name))
plural = Utils::Inflection.pluralize("formula", formulae_name_to_install.count, plural: "e")
plural = Utils.pluralize("formula", formulae_name_to_install.count, plural: "e")
ohai "Would install #{formulae_name_to_install.count} #{plural}:"
puts formulae_name_to_install.join(" ")
@ -354,7 +354,7 @@ module Homebrew
def print_dry_run_dependencies(formula, dependencies, &block)
return if dependencies.empty?
plural = Utils::Inflection.pluralize("dependenc", dependencies.count, plural: "ies", singular: "y")
plural = Utils.pluralize("dependenc", dependencies.count, plural: "ies", singular: "y")
ohai "Would install #{dependencies.count} #{plural} for #{formula.name}:"
formula_names = dependencies.map(&:first).map(&:to_formula).map(&block)
puts formula_names.join(" ")

View File

@ -61,7 +61,7 @@ module Homebrew
constant = Strategy.const_get(const_symbol)
next unless constant.is_a?(Class)
@livecheck_strategy_names[constant] = Utils::Inflection.demodulize(T.must(constant.name))
@livecheck_strategy_names[constant] = Utils.demodulize(T.must(constant.name))
end
@livecheck_strategy_names.freeze
end

View File

@ -74,7 +74,7 @@ module Homebrew
def self.find_versions(url:, regex: nil, **_unused, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils::Inflection.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
end
match_data = { matches: {}, regex: regex, url: url }

View File

@ -98,11 +98,11 @@ module Homebrew
def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils::Inflection.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
end
unless T.unsafe(cask)
raise ArgumentError,
"The #{Utils::Inflection.demodulize(T.must(name))} strategy only supports casks."
"The #{Utils.demodulize(T.must(name))} strategy only supports casks."
end
match_data = { matches: {}, regex: regex, url: url }

View File

@ -93,7 +93,7 @@ module Homebrew
}
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block)
if regex.blank? && block.blank?
raise ArgumentError, "#{Utils::Inflection.demodulize(T.must(name))} requires a regex or `strategy` block"
raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a regex or `strategy` block"
end
match_data = { matches: {}, regex: regex, url: url }

View File

@ -204,7 +204,7 @@ module Homebrew
def self.find_versions(url:, regex: nil, **_unused, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils::Inflection.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
end
match_data = { matches: {}, regex: regex, url: url }

View File

@ -475,15 +475,15 @@ class Tap
contents = []
if (command_count = command_files.count).positive?
contents << "#{command_count} #{Utils::Inflection.pluralize("command", command_count)}"
contents << "#{command_count} #{Utils.pluralize("command", command_count)}"
end
if (cask_count = cask_files.count).positive?
contents << "#{cask_count} #{Utils::Inflection.pluralize("cask", cask_count)}"
contents << "#{cask_count} #{Utils.pluralize("cask", cask_count)}"
end
if (formula_count = formula_files.count).positive?
contents << "#{formula_count} #{Utils::Inflection.pluralize("formula", formula_count, plural: "e")}"
contents << "#{formula_count} #{Utils.pluralize("formula", formula_count, plural: "e")}"
end
contents

View File

@ -52,7 +52,7 @@ module Homebrew
if rack.directory?
versions = rack.subdirs.map(&:basename)
puts <<~EOS
#{keg.name} #{versions.to_sentence} #{Utils::Inflection.pluralize("", versions.count, plural: "are", singular: "is")} still installed.
#{keg.name} #{versions.to_sentence} #{Utils.pluralize("", versions.count, plural: "are", singular: "is")} still installed.
To remove all versions, run:
brew uninstall --force #{keg.name}
EOS
@ -136,9 +136,9 @@ module Homebrew
end
def are_required_by_deps
"#{Utils::Inflection.pluralize("", reqs.count, plural: "are",
"#{Utils.pluralize("", reqs.count, plural: "are",
singular: "is")} required by #{deps.to_sentence}, " \
"which #{Utils::Inflection.pluralize("", deps.count, plural: "are", singular: "is")} currently installed"
"which #{Utils.pluralize("", deps.count, plural: "are", singular: "is")} currently installed"
end
end
@ -158,7 +158,7 @@ module Homebrew
def output
ofail <<~EOS
Refusing to uninstall #{reqs.to_sentence}
because #{Utils::Inflection.pluralize("", reqs.count, plural: "they", singular: "it")} #{are_required_by_deps}.
because #{Utils.pluralize("", reqs.count, plural: "they", singular: "it")} #{are_required_by_deps}.
You can override this and force removal with:
#{sample_command}
EOS

View File

@ -299,7 +299,7 @@ module Homebrew
.sort { |a, b| depends_on(a, b) }
if pinned_dependents.present?
plural = Utils::Inflection.pluralize("dependent", pinned_dependents.count)
plural = Utils.pluralize("dependent", pinned_dependents.count)
ohai "Not upgrading #{pinned_dependents.count} pinned #{plural}:"
puts(pinned_dependents.map do |f|
"#{f.full_specified_name} #{f.pkg_version}"
@ -310,8 +310,8 @@ module Homebrew
if upgradeable_dependents.blank?
ohai "No outdated dependents to upgrade!" unless dry_run
else
dependent_plural = Utils::Inflection.pluralize("dependent", upgradeable_dependents.count)
formula_plural = Utils::Inflection.pluralize("formula", installed_formulae.count, plural: "e")
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}:"
Upgrade.puts_no_installed_dependents_check_disable_message_if_not_already!
@ -375,7 +375,7 @@ module Homebrew
# Print the pinned dependents.
if outdated_pinned_broken_dependents.present?
count = outdated_pinned_broken_dependents.count
plural = Utils::Inflection.pluralize("dependent", outdated_pinned_broken_dependents.count)
plural = Utils.pluralize("dependent", outdated_pinned_broken_dependents.count)
onoe "Not reinstalling #{count} broken and outdated, but pinned #{plural}:"
$stderr.puts(outdated_pinned_broken_dependents.map do |f|
"#{f.full_specified_name} #{f.pkg_version}"
@ -387,7 +387,7 @@ module Homebrew
ohai "No broken dependents to reinstall!"
else
count = reinstallable_broken_dependents.count
plural = Utils::Inflection.pluralize("dependent", reinstallable_broken_dependents.count)
plural = Utils.pluralize("dependent", reinstallable_broken_dependents.count)
ohai "Reinstalling #{count} #{plural} with broken linkage from source:"
Upgrade.puts_no_installed_dependents_check_disable_message_if_not_already!
puts reinstallable_broken_dependents.map(&:full_specified_name)