utils: extract common word "for" in reason

This commit is contained in:
XuehaiPan 2021-11-23 23:59:09 +08:00
parent 466f29a16a
commit 9ef52080e3
7 changed files with 8 additions and 8 deletions

View File

@ -260,7 +260,7 @@ module Homebrew
return default_tar_args return default_tar_args
end end
ensure_formula_installed!(gnu_tar, reason: "for bottling") ensure_formula_installed!(gnu_tar, reason: "bottling")
["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze ["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze
end end

View File

@ -59,7 +59,7 @@ module Homebrew
unless Utils::Curl.curl_supports_tls13? unless Utils::Curl.curl_supports_tls13?
begin begin
unless Pathname.new(ENV["HOMEBREW_BREWED_CURL_PATH"]).exist? unless Pathname.new(ENV["HOMEBREW_BREWED_CURL_PATH"]).exist?
ensure_formula_installed!("curl", reason: "for Repology queries") ensure_formula_installed!("curl", reason: "Repology queries")
end end
rescue FormulaUnavailableError rescue FormulaUnavailableError
opoo "A `curl` with TLS 1.3 support is required for Repology queries." opoo "A `curl` with TLS 1.3 support is required for Repology queries."

View File

@ -34,7 +34,7 @@ module Homebrew
ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
ensure_formula_installed!( ensure_formula_installed!(
"bat", "bat",
reason: "for displaying <formula>/<cask> source", reason: "displaying <formula>/<cask> source",
# The user might want to capture the output of `brew cat ...` # The user might want to capture the output of `brew cat ...`
# Redirect stdout to stderr # Redirect stdout to stderr
output_to_stderr: true, output_to_stderr: true,

View File

@ -50,7 +50,7 @@ module Homebrew
with_env(HOMEBREW_NO_AUTO_UPDATE: "1", HOMEBREW_NO_BOOTSNAP: "1") do with_env(HOMEBREW_NO_AUTO_UPDATE: "1", HOMEBREW_NO_BOOTSNAP: "1") do
ensure_formula_installed!("buildpulse-test-reporter", ensure_formula_installed!("buildpulse-test-reporter",
reason: "for reporting test flakiness") reason: "reporting test flakiness")
end end
ENV["BUILDPULSE_ACCESS_KEY_ID"] = ENV["HOMEBREW_BUILDPULSE_ACCESS_KEY_ID"] ENV["BUILDPULSE_ACCESS_KEY_ID"] = ENV["HOMEBREW_BUILDPULSE_ACCESS_KEY_ID"]

View File

@ -48,7 +48,7 @@ class GitHubPackages
raise UsageError, "HOMEBREW_GITHUB_PACKAGES_USER is unset." if user.blank? raise UsageError, "HOMEBREW_GITHUB_PACKAGES_USER is unset." if user.blank?
raise UsageError, "HOMEBREW_GITHUB_PACKAGES_TOKEN is unset." if token.blank? raise UsageError, "HOMEBREW_GITHUB_PACKAGES_TOKEN is unset." if token.blank?
skopeo = ensure_executable!("skopeo", reason: "for upload") skopeo = ensure_executable!("skopeo", reason: "upload")
require "json_schemer" require "json_schemer"

View File

@ -279,13 +279,13 @@ module Homebrew
def shellcheck def shellcheck
# Always use the latest brewed shellcheck # Always use the latest brewed shellcheck
ensure_formula_installed!("shellcheck", latest: true, ensure_formula_installed!("shellcheck", latest: true,
reason: "for shell style checks").opt_bin/"shellcheck" reason: "shell style checks").opt_bin/"shellcheck"
end end
def shfmt def shfmt
# Always use the latest brewed shfmt # Always use the latest brewed shfmt
ensure_formula_installed!("shfmt", latest: true, ensure_formula_installed!("shfmt", latest: true,
reason: "to format shell scripts") reason: "formatting shell scripts")
HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh" HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh"
end end

View File

@ -461,7 +461,7 @@ module Kernel
Formula[formula_or_name] Formula[formula_or_name]
end end
reason = " #{reason}" if reason.present? # add a whitespace reason = " for #{reason}" if reason.present?
unless formula.any_version_installed? unless formula.any_version_installed?
ohai "Installing `#{formula.name}`#{reason}..." ohai "Installing `#{formula.name}`#{reason}..."