diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index c63d132b85448..351fcb8a18d05 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -38,10 +38,13 @@ def livecheck_args description: "Only check formulae." switch "--cask", "--casks", description: "Only check casks." + switch "--extract-plist", + description: "Include casks using the ExtractPlist livecheck strategy." conflicts "--debug", "--json" conflicts "--tap=", "--eval-all", "--installed" conflicts "--cask", "--formula" + conflicts "--formula", "--extract-plist" named_args [:formula, :cask], without_api: true end @@ -125,6 +128,7 @@ def livecheck handle_name_conflict: !args.formula? && !args.cask?, check_resources: args.resources?, newer_only: args.newer_only?, + extract_plist: args.extract_plist?, quiet: args.quiet?, debug: args.debug?, verbose: args.verbose?, diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index 6ab47d4992ba7..6285345d4c63e 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -167,6 +167,7 @@ def resolve_livecheck_reference( check_resources: T::Boolean, json: T::Boolean, newer_only: T::Boolean, + extract_plist: T::Boolean, debug: T::Boolean, quiet: T::Boolean, verbose: T::Boolean, @@ -175,7 +176,7 @@ def resolve_livecheck_reference( def run_checks( formulae_and_casks_to_check, 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) @@ -200,9 +201,9 @@ def run_checks( 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| stderr.puts Formatter.headline("Running checks", color: :blue) end @@ -217,6 +218,9 @@ def run_checks( ) 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| formula = formula_or_cask if formula_or_cask.is_a?(Formula) cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask) @@ -237,6 +241,18 @@ def run_checks( puts 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 if referenced_formula_or_cask skip_info = SkipConditions.referenced_skip_information( diff --git a/completions/bash/brew b/completions/bash/brew index 714db8a36a326..b31b140e78ba3 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -1330,6 +1330,7 @@ _brew_lc() { --cask --debug --eval-all + --extract-plist --formula --full-name --help @@ -1445,6 +1446,7 @@ _brew_livecheck() { --cask --debug --eval-all + --extract-plist --formula --full-name --help diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 35137e48e9181..a6c28825e77c5 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -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 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 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 full-name -d 'Print formulae and casks with fully-qualified names' __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 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 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 full-name -d 'Print formulae and casks with fully-qualified names' __fish_brew_complete_arg 'livecheck' -l help -d 'Show this message' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 24b2df93c0916..c793182cd792a 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1168,6 +1168,7 @@ _brew_lc() { _arguments \ '(--json)--debug[Display any debugging information]' \ '(--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]' \ '--help[Show this message]' \ '(--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]' \ '--verbose[Make some output more verbose]' \ - formula \ - '(--cask)--formula[Only check formulae]' \ + '(--cask --extract-plist)--formula[Only check formulae]' \ '*::formula:__brew_formulae' \ - cask \ '(--formula)--cask[Only check casks]' \ @@ -1254,6 +1255,7 @@ _brew_livecheck() { _arguments \ '(--json)--debug[Display any debugging information]' \ '(--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]' \ '--help[Show this message]' \ '(--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]' \ '--verbose[Make some output more verbose]' \ - formula \ - '(--cask)--formula[Only check formulae]' \ + '(--cask --extract-plist)--formula[Only check formulae]' \ '*::formula:__brew_formulae' \ - cask \ '(--formula)--cask[Only check casks]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 1039b7feea7eb..f7e0036530f72 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2288,6 +2288,10 @@ from `HOMEBREW_LIVECHECK_WATCHLIST` or `~/.homebrew/livecheck_watchlist.txt`. : Only check casks. +`--extract-plist` + +: Include casks using the ExtractPlist livecheck strategy. + ### `pr-automerge` \[*`options`*\] Find pull requests that can be automatically merged using `brew pr-publish`. diff --git a/manpages/brew.1 b/manpages/brew.1 index bc3ce39cb3aae..4b4d3c1ccc520 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1453,6 +1453,9 @@ Only check formulae\. .TP \fB\-\-cask\fP Only check casks\. +.TP +\fB\-\-extract\-plist\fP +Include casks using the ExtractPlist livecheck strategy\. .SS "\fBpr\-automerge\fP \fR[\fIoptions\fP]" Find pull requests that can be automatically merged using \fBbrew pr\-publish\fP\&\. .TP