Sha256: c275dfd03b09ab611c6750ff1737f208b9aa801111e950e7aaa38a9c9f7d4015

Contents?: true

Size: 635 Bytes

Versions: 74

Compression:

Stored size: 635 Bytes

Contents

#!/usr/bin/env ruby

require 'net/https'
require 'uri'
require 'json'

gem_name = ARGV[0]
github_repository = ARGV[1]

def get_json(url)
  uri = URI.parse(url)
  response = Net::HTTP.get_response(uri)
  versions = JSON.load(response.body)
end

versions = get_json("https://rubygems.org/api/v1/versions/#{gem_name}.json")
last_released_version = versions.reject { |g| g['prerelease'] }.map { |g| g['number'] }.sort_by(&Gem::Version.method(:new)).last

tag = get_json("https://api.github.com/repos/#{github_repository}/git/refs/tags/v#{last_released_version}")

print tag['object']['sha'] if tag && tag['object'] && tag['object']['sha']

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
shipit-engine-0.36.0 lib/snippets/fetch-gem-version
shipit-engine-0.35.1 lib/snippets/fetch-gem-version
shipit-engine-0.35.0 lib/snippets/fetch-gem-version
shipit-engine-0.34.0 lib/snippets/fetch-gem-version
shipit-engine-0.33.0 lib/snippets/fetch-gem-version
shipit-engine-0.32.0 lib/snippets/fetch-gem-version
shipit-engine-0.31.0 lib/snippets/fetch-gem-version
shipit-engine-0.30.0 lib/snippets/fetch-gem-version
shipit-engine-0.29.0 lib/snippets/fetch-gem-version
shipit-engine-0.28.1 lib/snippets/fetch-gem-version
shipit-engine-0.28.0 lib/snippets/fetch-gem-version
shipit-engine-0.27.1 lib/snippets/fetch-gem-version
shipit-engine-0.27.0 lib/snippets/fetch-gem-version
shipit-engine-0.26.0 lib/snippets/fetch-gem-version
shipit-engine-0.25.1 lib/snippets/fetch-gem-version
shipit-engine-0.25.0 lib/snippets/fetch-gem-version
shipit-engine-0.24.0 lib/snippets/fetch-gem-version
shipit-engine-0.23.1 lib/snippets/fetch-gem-version
shipit-engine-0.23.0 lib/snippets/fetch-gem-version
shipit-engine-0.22.0 lib/snippets/fetch-gem-version