Sha256: e068a5b737e4a231a16463ba1e0af974092909b02c3cc643a140b10a32b46241

Contents?: true

Size: 731 Bytes

Versions: 18

Compression:

Stored size: 731 Bytes

Contents

class CompareLinker
  class GithubTagFinder
    attr_reader :octokit, :gem_name, :repo_full_name

    def initialize(octokit, gem_name, repo_full_name)
      @octokit = octokit
      @gem_name = gem_name
      @repo_full_name = repo_full_name
    end

    def find(gem_version)
      tags = auto_paginate { octokit.tags(repo_full_name) }
      if tags
        tags.find { |tag|
          tag.name == gem_version ||
            tag.name == "v#{gem_version}" ||
            tag.name == "#{gem_name}-#{gem_version}"
        }
      end
    end

    private

    def auto_paginate
      original = octokit.auto_paginate
      octokit.auto_paginate = true
      yield
    ensure
      octokit.auto_paginate = original
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
compare_linker-1.4.8 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.7 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.6 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.5 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.4 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.3 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.2 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.1 lib/compare_linker/github_tag_finder.rb
compare_linker-1.4.0 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.8 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.7 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.6 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.5 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.4 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.3 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.2 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.1 lib/compare_linker/github_tag_finder.rb
compare_linker-1.3.0 lib/compare_linker/github_tag_finder.rb