Livecheck: Skip Google Code Archive stable URLs
This commit is contained in:
parent
84e058f6ca
commit
f36d1a7fb6
@ -354,12 +354,19 @@ module Homebrew
|
||||
return
|
||||
end
|
||||
|
||||
is_gist = formula&.stable&.url&.include?("gist.github.com")
|
||||
if formula_or_cask.livecheck.skip? || is_gist
|
||||
stable_from_google_code_archive = formula&.stable&.url&.match?(
|
||||
%r{https?://storage\.googleapis\.com/google-code-archive-downloads/}i,
|
||||
)
|
||||
stable_is_gist = formula&.stable&.url&.match?(%r{https?://gist\.github(?:usercontent)?\.com/}i)
|
||||
if formula_or_cask.livecheck.skip? ||
|
||||
((stable_from_google_code_archive ||
|
||||
stable_is_gist) && !formula&.livecheckable?)
|
||||
skip_message = if formula_or_cask.livecheck.skip_msg.is_a?(String) &&
|
||||
formula_or_cask.livecheck.skip_msg.present?
|
||||
formula_or_cask.livecheck.skip_msg.to_s.presence
|
||||
elsif is_gist
|
||||
elsif stable_from_google_code_archive
|
||||
"Stable URL is from Google Code Archive"
|
||||
elsif stable_is_gist
|
||||
"Stable URL is a GitHub Gist"
|
||||
end
|
||||
|
||||
|
||||
@ -225,6 +225,22 @@ describe Homebrew::Livecheck do
|
||||
end
|
||||
end
|
||||
|
||||
context "a formula with a Google Code Archive stable URL" do
|
||||
let(:f_google_code_archive) do
|
||||
formula("test_google_code_archive") do
|
||||
desc "Google Code Archive test formula"
|
||||
homepage "https://brew.sh"
|
||||
url "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/brew/brew-1.0.0.tar.gz"
|
||||
end
|
||||
end
|
||||
|
||||
it "skips" do
|
||||
expect { livecheck.skip_conditions(f_google_code_archive) }
|
||||
.to output("test_google_code_archive : skipped - Stable URL is from Google Code Archive\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
end
|
||||
end
|
||||
|
||||
context "a formula with a `livecheck` block containing `skip`" do
|
||||
let(:f_skip) do
|
||||
formula("test_skip") do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user