Class: GemEnforcer::Retrieve::GitTag
- Inherits:
-
Object
- Object
- GemEnforcer::Retrieve::GitTag
- Defined in:
- lib/gem_enforcer/retrieve/git_tag.rb
Instance Method Summary collapse
- #client ⇒ Object
- #gem_versions(name:) ⇒ Object
-
#initialize(owner:, access_token: GemEnforcer.github_access_token) ⇒ GitTag
constructor
A new instance of GitTag.
Constructor Details
#initialize(owner:, access_token: GemEnforcer.github_access_token) ⇒ GitTag
Returns a new instance of GitTag.
8 9 10 11 |
# File 'lib/gem_enforcer/retrieve/git_tag.rb', line 8 def initialize(owner:, access_token: GemEnforcer.github_access_token) @access_token = access_token @owner = owner end |
Instance Method Details
#client ⇒ Object
23 24 25 |
# File 'lib/gem_enforcer/retrieve/git_tag.rb', line 23 def client @client ||= ::Octokit::Client.new(access_token: @access_token) end |
#gem_versions(name:) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/gem_enforcer/retrieve/git_tag.rb', line 13 def gem_versions(name:) repo_name = "#{@owner}/#{name}" releases = client.releases(repo_name, { per_page: 50 }) while next_page_href = client.last_response.rels[:next]&.href releases.concat(client.get(next_page_href, { per_page: 50 })) end releases.map { Gem::Version.new(_1.tag_name.gsub(/.*?(?=\d*\.)/im, "")) }.compact end |