Sparkle: Add homebrew_curl support

`Sparkle` is the only strategy with a `find_versions` method that
calls `Strategy::page_content` (or `::page_headers`) and doesn't have
a `homebrew_curl` parameter. This adds the missing parameter and
passes the value to `page_content`, which brings it in line with the
other strategies.
This commit is contained in:
Sam Ford 2025-02-04 16:12:30 -05:00
parent 2187316262
commit a16f5666a8
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -214,16 +214,18 @@ module Homebrew
#
# @param url [String] the URL of the content to check
# @param regex [Regexp, nil] a regex for use in a strategy block
# @param homebrew_curl [Boolean] whether to use brewed curl with the URL
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
homebrew_curl: T::Boolean,
unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, homebrew_curl: false, **unused, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
@ -234,7 +236,8 @@ module Homebrew
match_data.merge!(
Strategy.page_content(
url,
url_options: unused.fetch(:url_options, {}),
url_options: unused.fetch(:url_options, {}),
homebrew_curl:,
),
)
content = match_data.delete(:content)