GithubRelease: Omit unnecessary prefix

This commit is contained in:
Sam Ford 2023-05-15 23:39:55 -04:00
parent a29b5c34d2
commit 8a0f63e728
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -116,15 +116,14 @@ module Homebrew
block: T.nilable(Proc), block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped]) ).returns(T::Hash[Symbol, T.untyped])
} }
def self.find_versions(url:, regex: GithubRelease::DEFAULT_REGEX, **_unused, &block) def self.find_versions(url:, regex: DEFAULT_REGEX, **_unused, &block)
match_data = { matches: {}, regex: regex } match_data = { matches: {}, regex: regex }
match = url.delete_suffix(".git") match = url.delete_suffix(".git")
.match(URL_MATCH_REGEX) .match(URL_MATCH_REGEX)
return match_data if match.blank? return match_data if match.blank?
releases = GitHub::API.open_rest("https://api.github.com/repos/#{match[:username]}/#{match[:repository]}/releases") releases = GitHub::API.open_rest("https://api.github.com/repos/#{match[:username]}/#{match[:repository]}/releases")
versions_from_content(releases, regex, &block).each do |match_text|
GithubRelease.versions_from_content(releases, regex, &block).each do |match_text|
match_data[:matches][match_text] = Version.new(match_text) match_data[:matches][match_text] = Version.new(match_text)
end end