Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

find and copy the latest version of a gem

View latest.rb
1 2 3 4 5 6
$ latest haml
request: http://rubygems.org/api/v1/gems/haml.json
version: 3.0.25
 
# cmd+v
$ 3.0.25
View latest.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/bin/env ruby
require "net/http"
require "uri"
require "json"
 
if gem = ARGV.first
uri = URI.parse("http://rubygems.org/api/v1/gems/#{gem}.json")
puts "request: #{uri}"
 
begin
response = Net::HTTP.get_response(uri)
version = JSON.parse(response.body)["version"]
puts "version: #{version}"
`echo "#{version}" | pbcopy`
rescue => e
puts "oops ..."
puts e
end
else
puts "what?"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.