Removed use_homebrew_curl? for resources
This commit is contained in:
parent
c111a5bc9d
commit
54c9338ed4
@ -583,7 +583,7 @@ resource: false)
|
||||
# livecheck should fetch a URL using brewed curl if the formula/resource/cask
|
||||
# contains a `stable`/`url` or `head` URL `using: :homebrew_curl` that
|
||||
# shares the same root domain.
|
||||
sig { params(package_or_resource: T.any(Formula, Cask::Cask, Resource), url: String).returns(T::Boolean) }
|
||||
sig { params(package_or_resource: T.any(Formula, Cask::Cask), url: String).returns(T::Boolean) }
|
||||
def use_homebrew_curl?(package_or_resource, url)
|
||||
url_root_domain = Addressable::URI.parse(url)&.domain
|
||||
return false if url_root_domain.blank?
|
||||
@ -602,11 +602,6 @@ resource: false)
|
||||
when Cask::Cask
|
||||
return false unless package_or_resource.url.using == :homebrew_curl
|
||||
|
||||
domain = Addressable::URI.parse(package_or_resource.url.to_s)&.domain
|
||||
homebrew_curl_root_domains << domain if domain.present?
|
||||
when Resource
|
||||
return false unless package_or_resource.url == :homebrew_curl
|
||||
|
||||
domain = Addressable::URI.parse(package_or_resource.url.to_s)&.domain
|
||||
homebrew_curl_root_domains << domain if domain.present?
|
||||
end
|
||||
@ -707,14 +702,9 @@ resource: false)
|
||||
end
|
||||
next if strategy.blank?
|
||||
|
||||
homebrew_curl = case strategy_name
|
||||
when "PageMatch", "HeaderMatch"
|
||||
use_homebrew_curl?(resource, url)
|
||||
end
|
||||
puts "Homebrew curl?: Yes" if debug && homebrew_curl.present?
|
||||
strategy_data = strategy.find_versions(
|
||||
url: url, regex: livecheck_regex,
|
||||
homebrew_curl: homebrew_curl, &livecheck_strategy_block
|
||||
homebrew_curl: false, &livecheck_strategy_block
|
||||
)
|
||||
match_version_map = strategy_data[:matches]
|
||||
regex = strategy_data[:regex]
|
||||
@ -791,7 +781,6 @@ resource: false)
|
||||
res_livecheck[:url][:strategy] = strategy_data[:url]
|
||||
end
|
||||
res_livecheck[:url][:final] = strategy_data[:final_url] if strategy_data[:final_url]
|
||||
res_livecheck[:url][:homebrew_curl] = homebrew_curl if homebrew_curl.present?
|
||||
res_livecheck[:strategy] = strategy.present? ? strategy_name : nil
|
||||
if strategies.present?
|
||||
res_livecheck[:strategies] = strategies.map do |s|
|
||||
|
||||
@ -81,7 +81,7 @@ describe Homebrew::Livecheck do
|
||||
end
|
||||
|
||||
it "returns the full name of the resource" do
|
||||
expect(livecheck.resource_name(r, full_name: true)).to eq("test--foo")
|
||||
expect(livecheck.resource_name(r, full_name: true)).to eq("foo")
|
||||
end
|
||||
end
|
||||
|
||||
@ -235,20 +235,8 @@ describe Homebrew::Livecheck do
|
||||
url "https://formulae.brew.sh/api/formula/ruby.json"
|
||||
regex(/"stable":"(\d+(?:\.\d+)+)"/i)
|
||||
end
|
||||
|
||||
resource "foo" do
|
||||
url "https://brew.sh/foo-1.0.tar.gz", using: :homebrew_curl
|
||||
sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
||||
|
||||
livecheck do
|
||||
url "https://brew.sh/test/releases"
|
||||
regex(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
let(:r_homebrew_curl) { f_homebrew_curl.resources.first }
|
||||
|
||||
let(:c_homebrew_curl) do
|
||||
Cask::CaskLoader.load(+<<-RUBY)
|
||||
@ -282,13 +270,6 @@ describe Homebrew::Livecheck do
|
||||
expect(livecheck.use_homebrew_curl?(c_homebrew_curl, example_url)).to be(false)
|
||||
end
|
||||
|
||||
it "returns `false` if a `using: homebrew_curl` is present in a resource url" do
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, livecheck_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, homepage_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, stable_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, example_url)).to be(false)
|
||||
end
|
||||
|
||||
it "returns `false` if a `using: homebrew_curl` URL is not present" do
|
||||
expect(livecheck.use_homebrew_curl?(f, livecheck_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(f, homepage_url)).to be(false)
|
||||
@ -302,7 +283,6 @@ describe Homebrew::Livecheck do
|
||||
|
||||
it "returns `false` if URL string does not contain a domain" do
|
||||
expect(livecheck.use_homebrew_curl?(f_homebrew_curl, "test")).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, "test")).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user