From cf40f7b8f648a28313f82c18b0059cd01a667e55 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 14 Dec 2020 02:49:32 +0100 Subject: [PATCH] Rename `FollowRedirection` to `HeaderMatch`. --- Library/Homebrew/livecheck/strategy.rb | 2 +- .../{follow_redirection.rb => header_match.rb} | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) rename Library/Homebrew/livecheck/strategy/{follow_redirection.rb => header_match.rb} (85%) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index 5527166bb9..a340b53446 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -130,11 +130,11 @@ require_relative "strategy/github_latest" require_relative "strategy/gnome" require_relative "strategy/gnu" require_relative "strategy/hackage" +require_relative "strategy/header_match" require_relative "strategy/launchpad" require_relative "strategy/npm" require_relative "strategy/page_match" require_relative "strategy/pypi" -require_relative "strategy/follow_redirection" require_relative "strategy/sourceforge" require_relative "strategy/sparkle" require_relative "strategy/xorg" diff --git a/Library/Homebrew/livecheck/strategy/follow_redirection.rb b/Library/Homebrew/livecheck/strategy/header_match.rb similarity index 85% rename from Library/Homebrew/livecheck/strategy/follow_redirection.rb rename to Library/Homebrew/livecheck/strategy/header_match.rb index d50b4c8eb3..7aedecac1c 100644 --- a/Library/Homebrew/livecheck/strategy/follow_redirection.rb +++ b/Library/Homebrew/livecheck/strategy/header_match.rb @@ -6,22 +6,23 @@ require_relative "page_match" module Homebrew module Livecheck module Strategy - # The {FollowRedirection} strategy follows all URL redirections and scans - # the final URL for matching text using the provided regex. + # The {HeaderMatch} strategy follows all URL redirections and scans + # the resulting headers for matching text using the provided regex. # # @api private - class FollowRedirection + class HeaderMatch extend T::Sig - NICE_NAME = "Follow HTTP Redirection" + NICE_NAME = "Match HTTP Headers" # We set the priority to zero since this cannot # be detected automatically. PRIORITY = 0 # Whether the strategy can be applied to the provided URL. - # FollowRedirection will technically match any HTTP URL but is - # only usable with a `livecheck` block containing a regex. + # The strategy will technically match any HTTP URL but is + # only usable with a `livecheck` block containing a regex + # or block. sig { params(url: String).returns(T::Boolean) } def self.match?(url) url.match?(%r{^https?://})