HeaderMatch: Align with PageMatch
This commit is contained in:
parent
edf6a11be6
commit
cc5cd4bf59
@ -15,17 +15,22 @@ module Homebrew
|
|||||||
|
|
||||||
NICE_NAME = "Header match"
|
NICE_NAME = "Header match"
|
||||||
|
|
||||||
# We set the priority to zero since this cannot
|
# A priority of zero causes livecheck to skip the strategy. We only
|
||||||
# be detected automatically.
|
# apply {HeaderMatch} using `strategy :header_match` in a `livecheck`
|
||||||
|
# block, as we can't automatically determine when this can be
|
||||||
|
# successfully applied to a URL.
|
||||||
PRIORITY = 0
|
PRIORITY = 0
|
||||||
|
|
||||||
|
# The `Regexp` used to determine if the strategy applies to the URL.
|
||||||
|
URL_MATCH_REGEX = %r{^https?://}i.freeze
|
||||||
|
|
||||||
# Whether the strategy can be applied to the provided URL.
|
# Whether the strategy can be applied to the provided URL.
|
||||||
# The strategy will technically match any HTTP URL but is
|
# The strategy will technically match any HTTP URL but is
|
||||||
# only usable with a `livecheck` block containing a regex
|
# only usable with a `livecheck` block containing a regex
|
||||||
# or block.
|
# or block.
|
||||||
sig { params(url: String).returns(T::Boolean) }
|
sig { params(url: String).returns(T::Boolean) }
|
||||||
def self.match?(url)
|
def self.match?(url)
|
||||||
url.match?(%r{^https?://})
|
URL_MATCH_REGEX.match?(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks the final URL for new versions after following all redirections,
|
# Checks the final URL for new versions after following all redirections,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user