lib/rubygems/comparator.rb in gem-compare-1.0.0 vs lib/rubygems/comparator.rb in gem-compare-1.1.0
- old
+ new
@@ -1,9 +1,9 @@
require 'tmpdir'
require 'rbconfig'
require 'rainbow'
-require 'curb'
+require 'uri'
require 'json'
require 'rubygems/package'
require 'rubygems/dependency'
require 'rubygems/spec_fetcher'
require 'rubygems/remote_fetcher'
@@ -186,14 +186,11 @@
info "Expanded versions: #{versions}"
versions
end
def remote_gem_versions(gem_name)
- client = Curl::Easy.new
- client.url = "https://rubygems.org/api/v1/versions/#{gem_name}.json"
- client.follow_location = true
- client.http_get
- json = JSON.parse(client.body_str)
+ body_str = URI.open("https://rubygems.org/api/v1/versions/#{gem_name}.json").read
+ json = JSON.parse(body_str)
gems = json.collect { |version| version['number'] }
info "Upstream versions: #{gems}"
gems
# "This rubygem could not be found."
rescue JSON::ParserError