chore: rename GitHubRelease to GitHubReleases

This commit is contained in:
Sean Molenaar 2023-05-16 19:51:20 +02:00 committed by Sam Ford
parent bed4737826
commit 940b63cad3
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D
3 changed files with 10 additions and 10 deletions

View File

@ -41,7 +41,7 @@ module Homebrew
# @return [Boolean] # @return [Boolean]
sig { params(url: String).returns(T::Boolean) } sig { params(url: String).returns(T::Boolean) }
def self.match?(url) def self.match?(url)
GitHubRelease.match?(url) GitHubReleases.match?(url)
end end
# Extracts information from a provided URL and uses it to generate # Extracts information from a provided URL and uses it to generate
@ -55,7 +55,7 @@ module Homebrew
def self.generate_input_values(url) def self.generate_input_values(url)
values = {} values = {}
match = url.delete_suffix(".git").match(GitHubRelease::URL_MATCH_REGEX) match = url.delete_suffix(".git").match(GitHubReleases::URL_MATCH_REGEX)
return values if match.blank? return values if match.blank?
values[:url] = "https://api.github.com/repos/#{match[:username]}/#{match[:repository]}/releases/latest" values[:url] = "https://api.github.com/repos/#{match[:username]}/#{match[:repository]}/releases/latest"
@ -79,7 +79,7 @@ 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: GitHubReleases::DEFAULT_REGEX, **_unused, &block)
match_data = { matches: {}, regex: regex, url: url } match_data = { matches: {}, regex: regex, url: url }
generated = generate_input_values(url) generated = generate_input_values(url)
@ -88,7 +88,7 @@ module Homebrew
match_data[:url] = generated[:url] match_data[:url] = generated[:url]
release = GitHub.get_latest_release(generated[:username], generated[:repository]) release = GitHub.get_latest_release(generated[:username], generated[:repository])
GitHubRelease.versions_from_content(release, regex, &block).each do |match_text| GitHubReleases.versions_from_content(release, 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

View File

@ -4,7 +4,7 @@
module Homebrew module Homebrew
module Livecheck module Livecheck
module Strategy module Strategy
# The {GithubRelease} strategy identifies versions of software at # The {GithubReleases} strategy identifies versions of software at
# github.com by checking a repository's recent releases using the # github.com by checking a repository's recent releases using the
# GitHub API. # GitHub API.
# #
@ -14,7 +14,7 @@ module Homebrew
# * `https://github.com/example/example/archive/v1.2.3.tar.gz` # * `https://github.com/example/example/archive/v1.2.3.tar.gz`
# * `https://github.com/downloads/example/example/example-1.2.3.tar.gz` # * `https://github.com/downloads/example/example/example-1.2.3.tar.gz`
# #
# {GithubRelease} should only be used when the upstream repository has # {GithubReleases} should only be used when the upstream repository has
# releases for suitable versions and the strategy is necessary or # releases for suitable versions and the strategy is necessary or
# appropriate (e.g. the formula/cask uses a release asset and the # appropriate (e.g. the formula/cask uses a release asset and the
# {GithubLatest} strategy isn't sufficient to identify the newest version. # {GithubLatest} strategy isn't sufficient to identify the newest version.
@ -28,11 +28,11 @@ module Homebrew
# etc.). # etc.).
# #
# @api public # @api public
class GithubRelease class GithubReleases
NICE_NAME = "GitHub - Releases" NICE_NAME = "GitHub - Releases"
# A priority of zero causes livecheck to skip the strategy. We do this # A priority of zero causes livecheck to skip the strategy. We do this
# for {GithubRelease} so we can selectively apply the strategy using # for {GithubReleases} so we can selectively apply the strategy using
# `strategy :github_release` in a `livecheck` block. # `strategy :github_release` in a `livecheck` block.
PRIORITY = 0 PRIORITY = 0
@ -150,6 +150,6 @@ module Homebrew
end end
end end
end end
GitHubRelease = Homebrew::Livecheck::Strategy::GithubRelease GitHubReleases = Homebrew::Livecheck::Strategy::GithubReleases
end end
end end

View File

@ -2,7 +2,7 @@
require "livecheck/strategy" require "livecheck/strategy"
describe Homebrew::Livecheck::Strategy::GithubRelease do describe Homebrew::Livecheck::Strategy::GitHubReleases do
subject(:github_release) { described_class } subject(:github_release) { described_class }
let(:github_urls) do let(:github_urls) do