livecheck: add --extract-plist switch

This commit is contained in:
Razvan Azamfirei 2024-03-21 11:47:37 +00:00 committed by Mike McQuaid
parent 59c894a9a8
commit 4129200b96
No known key found for this signature in database
7 changed files with 38 additions and 5 deletions

View File

@ -38,10 +38,13 @@ module Homebrew
description: "Only check formulae." description: "Only check formulae."
switch "--cask", "--casks", switch "--cask", "--casks",
description: "Only check casks." description: "Only check casks."
switch "--extract-plist",
description: "Include casks using the ExtractPlist livecheck strategy."
conflicts "--debug", "--json" conflicts "--debug", "--json"
conflicts "--tap=", "--eval-all", "--installed" conflicts "--tap=", "--eval-all", "--installed"
conflicts "--cask", "--formula" conflicts "--cask", "--formula"
conflicts "--formula", "--extract-plist"
named_args [:formula, :cask], without_api: true named_args [:formula, :cask], without_api: true
end end
@ -125,6 +128,7 @@ module Homebrew
handle_name_conflict: !args.formula? && !args.cask?, handle_name_conflict: !args.formula? && !args.cask?,
check_resources: args.resources?, check_resources: args.resources?,
newer_only: args.newer_only?, newer_only: args.newer_only?,
extract_plist: args.extract_plist?,
quiet: args.quiet?, quiet: args.quiet?,
debug: args.debug?, debug: args.debug?,
verbose: args.verbose?, verbose: args.verbose?,

View File

@ -167,6 +167,7 @@ module Homebrew
check_resources: T::Boolean, check_resources: T::Boolean,
json: T::Boolean, json: T::Boolean,
newer_only: T::Boolean, newer_only: T::Boolean,
extract_plist: T::Boolean,
debug: T::Boolean, debug: T::Boolean,
quiet: T::Boolean, quiet: T::Boolean,
verbose: T::Boolean, verbose: T::Boolean,
@ -175,7 +176,7 @@ module Homebrew
def run_checks( def run_checks(
formulae_and_casks_to_check, formulae_and_casks_to_check,
full_name: false, handle_name_conflict: false, check_resources: false, json: false, newer_only: false, full_name: false, handle_name_conflict: false, check_resources: false, json: false, newer_only: false,
debug: false, quiet: false, verbose: false extract_plist: false, debug: false, quiet: false, verbose: false
) )
load_other_tap_strategies(formulae_and_casks_to_check) load_other_tap_strategies(formulae_and_casks_to_check)
@ -200,9 +201,9 @@ module Homebrew
has_a_newer_upstream_version = T.let(false, T::Boolean) has_a_newer_upstream_version = T.let(false, T::Boolean)
if json && !quiet && $stderr.tty?
formulae_and_casks_total = formulae_and_casks_to_check.count formulae_and_casks_total = formulae_and_casks_to_check.count
if json && !quiet && $stderr.tty?
Tty.with($stderr) do |stderr| Tty.with($stderr) do |stderr|
stderr.puts Formatter.headline("Running checks", color: :blue) stderr.puts Formatter.headline("Running checks", color: :blue)
end end
@ -217,6 +218,9 @@ module Homebrew
) )
end end
# If only one formula/cask is being checked, we enable extract-plist
extract_plist = true if formulae_and_casks_total == 1
formulae_checked = formulae_and_casks_to_check.map.with_index do |formula_or_cask, i| formulae_checked = formulae_and_casks_to_check.map.with_index do |formula_or_cask, i|
formula = formula_or_cask if formula_or_cask.is_a?(Formula) formula = formula_or_cask if formula_or_cask.is_a?(Formula)
cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask)
@ -237,6 +241,18 @@ module Homebrew
puts puts
end end
if cask && !extract_plist && formula_or_cask.livecheck.strategy == :extract_plist
skip_info = {
cask: cask.token,
status: "skipped",
messages: ["Livecheck skipped due to the ExtractPlist strategy"],
meta: { livecheckable: true },
}
SkipConditions.print_skip_information(skip_info) if !newer_only && !quiet
next
end
# Check skip conditions for a referenced formula/cask # Check skip conditions for a referenced formula/cask
if referenced_formula_or_cask if referenced_formula_or_cask
skip_info = SkipConditions.referenced_skip_information( skip_info = SkipConditions.referenced_skip_information(

View File

@ -1330,6 +1330,7 @@ _brew_lc() {
--cask --cask
--debug --debug
--eval-all --eval-all
--extract-plist
--formula --formula
--full-name --full-name
--help --help
@ -1445,6 +1446,7 @@ _brew_livecheck() {
--cask --cask
--debug --debug
--eval-all --eval-all
--extract-plist
--formula --formula
--full-name --full-name
--help --help

View File

@ -941,6 +941,7 @@ __fish_brew_complete_cmd 'lc' 'Check for newer versions of formulae and/or casks
__fish_brew_complete_arg 'lc' -l cask -d 'Only check casks' __fish_brew_complete_arg 'lc' -l cask -d 'Only check casks'
__fish_brew_complete_arg 'lc' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'lc' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'lc' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to check them' __fish_brew_complete_arg 'lc' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to check them'
__fish_brew_complete_arg 'lc' -l extract-plist -d 'Include casks using the ExtractPlist livecheck strategy'
__fish_brew_complete_arg 'lc' -l formula -d 'Only check formulae' __fish_brew_complete_arg 'lc' -l formula -d 'Only check formulae'
__fish_brew_complete_arg 'lc' -l full-name -d 'Print formulae and casks with fully-qualified names' __fish_brew_complete_arg 'lc' -l full-name -d 'Print formulae and casks with fully-qualified names'
__fish_brew_complete_arg 'lc' -l help -d 'Show this message' __fish_brew_complete_arg 'lc' -l help -d 'Show this message'
@ -1011,6 +1012,7 @@ __fish_brew_complete_cmd 'livecheck' 'Check for newer versions of formulae and/o
__fish_brew_complete_arg 'livecheck' -l cask -d 'Only check casks' __fish_brew_complete_arg 'livecheck' -l cask -d 'Only check casks'
__fish_brew_complete_arg 'livecheck' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'livecheck' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'livecheck' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to check them' __fish_brew_complete_arg 'livecheck' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to check them'
__fish_brew_complete_arg 'livecheck' -l extract-plist -d 'Include casks using the ExtractPlist livecheck strategy'
__fish_brew_complete_arg 'livecheck' -l formula -d 'Only check formulae' __fish_brew_complete_arg 'livecheck' -l formula -d 'Only check formulae'
__fish_brew_complete_arg 'livecheck' -l full-name -d 'Print formulae and casks with fully-qualified names' __fish_brew_complete_arg 'livecheck' -l full-name -d 'Print formulae and casks with fully-qualified names'
__fish_brew_complete_arg 'livecheck' -l help -d 'Show this message' __fish_brew_complete_arg 'livecheck' -l help -d 'Show this message'

View File

@ -1168,6 +1168,7 @@ _brew_lc() {
_arguments \ _arguments \
'(--json)--debug[Display any debugging information]' \ '(--json)--debug[Display any debugging information]' \
'(--tap --installed)--eval-all[Evaluate all available formulae and casks, whether installed or not, to check them]' \ '(--tap --installed)--eval-all[Evaluate all available formulae and casks, whether installed or not, to check them]' \
'(--formula)--extract-plist[Include casks using the ExtractPlist livecheck strategy]' \
'--full-name[Print formulae and casks with fully-qualified names]' \ '--full-name[Print formulae and casks with fully-qualified names]' \
'--help[Show this message]' \ '--help[Show this message]' \
'(--tap --eval-all)--installed[Check formulae and casks that are currently installed]' \ '(--tap --eval-all)--installed[Check formulae and casks that are currently installed]' \
@ -1178,7 +1179,7 @@ _brew_lc() {
'(--eval-all --installed)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \ '(--eval-all --installed)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \
'--verbose[Make some output more verbose]' \ '--verbose[Make some output more verbose]' \
- formula \ - formula \
'(--cask)--formula[Only check formulae]' \ '(--cask --extract-plist)--formula[Only check formulae]' \
'*::formula:__brew_formulae' \ '*::formula:__brew_formulae' \
- cask \ - cask \
'(--formula)--cask[Only check casks]' \ '(--formula)--cask[Only check casks]' \
@ -1254,6 +1255,7 @@ _brew_livecheck() {
_arguments \ _arguments \
'(--json)--debug[Display any debugging information]' \ '(--json)--debug[Display any debugging information]' \
'(--tap --installed)--eval-all[Evaluate all available formulae and casks, whether installed or not, to check them]' \ '(--tap --installed)--eval-all[Evaluate all available formulae and casks, whether installed or not, to check them]' \
'(--formula)--extract-plist[Include casks using the ExtractPlist livecheck strategy]' \
'--full-name[Print formulae and casks with fully-qualified names]' \ '--full-name[Print formulae and casks with fully-qualified names]' \
'--help[Show this message]' \ '--help[Show this message]' \
'(--tap --eval-all)--installed[Check formulae and casks that are currently installed]' \ '(--tap --eval-all)--installed[Check formulae and casks that are currently installed]' \
@ -1264,7 +1266,7 @@ _brew_livecheck() {
'(--eval-all --installed)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \ '(--eval-all --installed)--tap[Check formulae and casks within the given tap, specified as user`/`repo]' \
'--verbose[Make some output more verbose]' \ '--verbose[Make some output more verbose]' \
- formula \ - formula \
'(--cask)--formula[Only check formulae]' \ '(--cask --extract-plist)--formula[Only check formulae]' \
'*::formula:__brew_formulae' \ '*::formula:__brew_formulae' \
- cask \ - cask \
'(--formula)--cask[Only check casks]' \ '(--formula)--cask[Only check casks]' \

View File

@ -2288,6 +2288,10 @@ from `HOMEBREW_LIVECHECK_WATCHLIST` or `~/.homebrew/livecheck_watchlist.txt`.
: Only check casks. : Only check casks.
`--extract-plist`
: Include casks using the ExtractPlist livecheck strategy.
### `pr-automerge` \[*`options`*\] ### `pr-automerge` \[*`options`*\]
Find pull requests that can be automatically merged using `brew pr-publish`. Find pull requests that can be automatically merged using `brew pr-publish`.

View File

@ -1453,6 +1453,9 @@ Only check formulae\.
.TP .TP
\fB\-\-cask\fP \fB\-\-cask\fP
Only check casks\. Only check casks\.
.TP
\fB\-\-extract\-plist\fP
Include casks using the ExtractPlist livecheck strategy\.
.SS "\fBpr\-automerge\fP \fR[\fIoptions\fP]" .SS "\fBpr\-automerge\fP \fR[\fIoptions\fP]"
Find pull requests that can be automatically merged using \fBbrew pr\-publish\fP\&\. Find pull requests that can be automatically merged using \fBbrew pr\-publish\fP\&\.
.TP .TP