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