Merge pull request #17748 from Homebrew/brew_bump_all
`brew bump`: cleanup and improve `--eval-all` handling
This commit is contained in:
commit
9e7eef33a6
@ -22,9 +22,9 @@ module Homebrew
|
||||
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Display out-of-date brew formulae and the latest version available. If the
|
||||
Displays out-of-date packages and the latest version available. If the
|
||||
returned current and livecheck versions differ or when querying specific
|
||||
formulae, also displays whether a pull request has been opened with the URL.
|
||||
packages, also displays whether a pull request has been opened with the URL.
|
||||
EOS
|
||||
switch "--full-name",
|
||||
description: "Print formulae/casks with fully-qualified names."
|
||||
@ -46,13 +46,12 @@ module Homebrew
|
||||
description: "Don't try to fork the repository."
|
||||
switch "--open-pr",
|
||||
description: "Open a pull request for the new version if none have been opened yet."
|
||||
flag "--limit=",
|
||||
description: "Limit number of package results returned."
|
||||
flag "--start-with=",
|
||||
description: "Letter or word that the list of package results should alphabetically follow."
|
||||
|
||||
conflicts "--cask", "--formula"
|
||||
conflicts "--tap=", "--installed"
|
||||
conflicts "--eval-all", "--installed"
|
||||
conflicts "--no-pull-requests", "--open-pr"
|
||||
|
||||
named_args [:formula, :cask], without_api: true
|
||||
@ -62,11 +61,9 @@ module Homebrew
|
||||
def run
|
||||
Homebrew.install_bundler_gems!(groups: ["livecheck"])
|
||||
|
||||
if args.limit.present? && !args.formula? && !args.cask?
|
||||
raise UsageError, "`--limit` must be used with either `--formula` or `--cask`."
|
||||
end
|
||||
|
||||
Homebrew.with_no_api_env do
|
||||
eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all?
|
||||
|
||||
formulae_and_casks = if args.tap
|
||||
tap = Tap.fetch(T.must(args.tap))
|
||||
raise UsageError, "`--tap` cannot be used with official taps." if tap.official?
|
||||
@ -80,17 +77,28 @@ module Homebrew
|
||||
formulae + casks
|
||||
elsif args.named.present?
|
||||
args.named.to_formulae_and_casks_with_taps
|
||||
else
|
||||
formulae = args.cask? ? [] : Formula.all(eval_all: args.eval_all?)
|
||||
casks = args.formula? ? [] : Cask::Cask.all(eval_all: args.eval_all?)
|
||||
elsif eval_all
|
||||
formulae = args.cask? ? [] : Formula.all(eval_all:)
|
||||
casks = args.formula? ? [] : Cask::Cask.all(eval_all:)
|
||||
formulae + casks
|
||||
else
|
||||
raise UsageError,
|
||||
"`brew bump` without named arguments needs `--installed` or `--eval-all` passed or " \
|
||||
"`HOMEBREW_EVAL_ALL` set!"
|
||||
end
|
||||
|
||||
if args.start_with
|
||||
formulae_and_casks.select! do |formula_or_cask|
|
||||
name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
|
||||
name.start_with?(args.start_with)
|
||||
end
|
||||
end
|
||||
|
||||
formulae_and_casks = formulae_and_casks&.sort_by do |formula_or_cask|
|
||||
formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
|
||||
end
|
||||
|
||||
unless Utils::Curl.curl_supports_tls13?
|
||||
if args.repology? && !Utils::Curl.curl_supports_tls13?
|
||||
begin
|
||||
ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist?
|
||||
rescue FormulaUnavailableError
|
||||
@ -98,7 +106,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
handle_formula_and_casks(formulae_and_casks)
|
||||
handle_formulae_and_casks(formulae_and_casks)
|
||||
end
|
||||
end
|
||||
|
||||
@ -113,7 +121,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
sig { params(formulae_and_casks: T::Array[T.any(Formula, Cask::Cask)]).void }
|
||||
def handle_formula_and_casks(formulae_and_casks)
|
||||
def handle_formulae_and_casks(formulae_and_casks)
|
||||
Livecheck.load_other_tap_strategies(formulae_and_casks)
|
||||
|
||||
ambiguous_casks = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user