Enforce strategy url requirement in latest_version

This commit is contained in:
Sam Ford 2020-12-18 22:11:36 -05:00
parent f5774c1af4
commit a55686a0e2
No known key found for this signature in database
GPG Key ID: 95209E46C7FFDEFE
2 changed files with 5 additions and 3 deletions

View File

@ -498,6 +498,11 @@ module Homebrew
next
end
if livecheck_strategy.present? && livecheck_url.blank?
odebug "#{strategy_name} strategy requires a url"
next
end
if livecheck_strategy.present? && strategies.exclude?(strategy)
odebug "#{strategy_name} strategy does not apply to this URL"
next

View File

@ -63,9 +63,6 @@ module Homebrew
# Only treat the `PageMatch` strategy as usable if a regex is
# present in the `livecheck` block
next unless regex_provided || block_provided
elsif strategy == Sparkle
# Skip the `Sparkle` strategy if the URL is not specified explicitly.
next unless url_provided
elsif strategy.const_defined?(:PRIORITY) &&
!strategy::PRIORITY.positive? &&
from_symbol(livecheck_strategy) != strategy