outdated: Fail when user supplies formulae and some are outdated
This commit is contained in:
parent
a3da9fa350
commit
966131f768
@ -24,8 +24,8 @@ module Homebrew
|
|||||||
flag "--json",
|
flag "--json",
|
||||||
description: "Print output in JSON format. Currently the default and only accepted "\
|
description: "Print output in JSON format. Currently the default and only accepted "\
|
||||||
"value for <version> is `v1`. See the docs for examples of using the JSON "\
|
"value for <version> is `v1`. See the docs for examples of using the JSON "\
|
||||||
"output: <https://docs.brew.sh/Querying-Brew>."\
|
"output: <https://docs.brew.sh/Querying-Brew>. "\
|
||||||
"By default, this option treats all arguments as formulae."\
|
"By default, this option treats all arguments as formulae. "\
|
||||||
"To treat arguments as casks, use the --cask-only option."
|
"To treat arguments as casks, use the --cask-only option."
|
||||||
switch "--fetch-HEAD",
|
switch "--fetch-HEAD",
|
||||||
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
|
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
|
||||||
@ -53,13 +53,9 @@ module Homebrew
|
|||||||
if args.formula_only? || !args.cask_only? && args.json
|
if args.formula_only? || !args.cask_only? && args.json
|
||||||
formulae = args.resolved_formulae.blank? ? Formula.installed : args.resolved_formulae
|
formulae = args.resolved_formulae.blank? ? Formula.installed : args.resolved_formulae
|
||||||
outdated = print_outdated_formulae(formulae)
|
outdated = print_outdated_formulae(formulae)
|
||||||
|
|
||||||
Homebrew.failed = !formulae.blank? && !outdated.blank?
|
|
||||||
elsif args.cask_only?
|
elsif args.cask_only?
|
||||||
casks = args.named.blank? ? Cask::Caskroom.casks : args.named
|
casks = args.named.blank? ? Cask::Caskroom.casks : args.named
|
||||||
outdated = print_outdated_casks(casks)
|
outdated = print_outdated_casks(casks)
|
||||||
|
|
||||||
Homebrew.failed = !casks.blank? && !outdated.blank?
|
|
||||||
else
|
else
|
||||||
formulae, casks = args.resolved_formulae_casks
|
formulae, casks = args.resolved_formulae_casks
|
||||||
|
|
||||||
@ -68,11 +64,10 @@ module Homebrew
|
|||||||
casks = Cask::Caskroom.casks
|
casks = Cask::Caskroom.casks
|
||||||
end
|
end
|
||||||
|
|
||||||
outdated_formulae = print_outdated_formulae(formulae)
|
outdated = print_outdated_formulae(formulae) + print_outdated_casks(casks)
|
||||||
outdated_casks = print_outdated_casks(casks)
|
|
||||||
|
|
||||||
Homebrew.failed = !formulae.blank? && !outdated_formulae.blank? || !casks.blank? && !outdated_casks.blank?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew.failed = args.named.present? && outdated.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_outdated_formulae(formulae)
|
def print_outdated_formulae(formulae)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user