Only require livecheck block URL when appropriate
`ExtractPlist` doesn't require a URL like other strategies (it takes a `Cask` instead) but we've had to provide one in existing `livecheck` blocks to get past this requirement in livecheck. This commit makes it so this requirement is only enforced when a strategy's `#find_versions` method has a required `url` parameter (not an optional one, as in `ExtractPlist`).
This commit is contained in:
parent
d7a26cd6d3
commit
2194f6e12b
@ -563,6 +563,7 @@ module Homebrew
|
|||||||
|
|
||||||
# Identifies the latest version of the formula and returns a Hash containing
|
# Identifies the latest version of the formula and returns a Hash containing
|
||||||
# the version information. Returns nil if a latest version couldn't be found.
|
# the version information. Returns nil if a latest version couldn't be found.
|
||||||
|
# rubocop:disable Metrics/CyclomaticComplexity
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
formula_or_cask: T.any(Formula, Cask::Cask),
|
formula_or_cask: T.any(Formula, Cask::Cask),
|
||||||
@ -657,7 +658,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if livecheck_strategy.present?
|
if livecheck_strategy.present?
|
||||||
if livecheck_url.blank?
|
if livecheck_url.blank? && strategy.method(:find_versions).parameters.include?([:keyreq, :url])
|
||||||
odebug "#{strategy_name} strategy requires a URL"
|
odebug "#{strategy_name} strategy requires a URL"
|
||||||
next
|
next
|
||||||
elsif livecheck_strategy != :page_match && strategies.exclude?(strategy)
|
elsif livecheck_strategy != :page_match && strategies.exclude?(strategy)
|
||||||
@ -768,6 +769,7 @@ module Homebrew
|
|||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/CyclomaticComplexity
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/ModuleLength
|
# rubocop:enable Metrics/ModuleLength
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user