audit: cleanup prerelease detection.
This commit is contained in:
parent
5578845e3f
commit
afa5713e63
@ -777,7 +777,7 @@ module Homebrew
|
|||||||
.split(".", 3)
|
.split(".", 3)
|
||||||
.map(&:to_i)
|
.map(&:to_i)
|
||||||
|
|
||||||
case stable.url
|
case (url = stable.url)
|
||||||
when /[\d\._-](alpha|beta|rc\d)/
|
when /[\d\._-](alpha|beta|rc\d)/
|
||||||
matched = Regexp.last_match(1)
|
matched = Regexp.last_match(1)
|
||||||
version_prefix = stable_version_string.sub(/\d+$/, "")
|
version_prefix = stable_version_string.sub(/\d+$/, "")
|
||||||
@ -795,16 +795,23 @@ module Homebrew
|
|||||||
return if stable_url_minor_version.even?
|
return if stable_url_minor_version.even?
|
||||||
|
|
||||||
problem "#{stable.version} is a development release"
|
problem "#{stable.version} is a development release"
|
||||||
when %r{^https://github.com/}
|
when %r{^https://github.com/([\w-]+)/([\w-]+)/}
|
||||||
owner = stable.url.match(%r{https://github.com/(.*?)(/)})[1]
|
owner = Regexp.last_match(1)
|
||||||
tag = stable.url.match(%r{https://github.com/.*(download|archive)/(\D*(\d*.){2}\d*)})[2]
|
repo = Regexp.last_match(2)
|
||||||
|
tag = url.match(%r{^https://github\.com/[\w-]+/[\w-]+/archive/([^/]+)\.(tar\.gz|zip)$})
|
||||||
|
.to_a
|
||||||
|
.second
|
||||||
|
tag ||= url.match(%r{^https://github\.com/[\w-]+/[\w-]+/releases/download/([^/]+)/})
|
||||||
|
.to_a
|
||||||
|
.second
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if GitHub.open_api("#{GitHub::API_URL}/repos/#{owner}/#{stable.full_name}/releases/tags/#{tag}")\
|
if (release = GitHub.open_api("#{GitHub::API_URL}/repos/#{owner}/#{repo}/releases/tags/#{tag}"))
|
||||||
["prerelease"]
|
problem "#{tag} is a GitHub prerelease" if release["prerelease"]
|
||||||
problem "#{tag} is a GitHub prerelease"
|
|
||||||
end
|
end
|
||||||
rescue GitHub::HTTPNotFoundError => e
|
rescue GitHub::HTTPNotFoundError
|
||||||
opoo e.message
|
# No-op if we can't find the release.
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user