From 1362d7d0ac1116c7f8060cf436041b20edcbca45 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Wed, 27 Jul 2011 01:35:53 -0700 Subject: [PATCH] Remove multi_json dependency by requiring Ruby 1.9 This was the last lingering dependency. I was able to convert almost every method to request and parse YAML instead of JSON but I got stuck on rubygems/gemcutter#323. Ruby 1.9 includes JSON as part of the standard library, so by requiring 1.9, I don't need to specify it as a dependency. Users of older Ruby versions can hack around this constraint by force-installing the gem and requiring a JSON library manually. Closes #4. --- .travis.yml | 7 +++---- gems.gemspec | 24 ++++++++++++------------ lib/gems/client.rb | 4 ++-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 961fe1a..5516618 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ rvm: - - 1.8.7 + - 1.9.1 - 1.9.2 - - jruby - - rbx - - ree + - 1.9.2-head + - 1.9.3-head - ruby-head diff --git a/gems.gemspec b/gems.gemspec index 7a90bce..52c5d3e 100644 --- a/gems.gemspec +++ b/gems.gemspec @@ -9,18 +9,18 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.6' gem.add_development_dependency 'yard', '~> 0.7' - gem.add_runtime_dependency 'multi_json', '~> 1.0.3' - gem.authors = ["Erik Michaels-Ober"] - gem.email = ['sferik@gmail.com'] - gem.description = %q{Ruby wrapper for the RubyGems.org API} - gem.summary = gem.description - gem.homepage = 'https://github.com/sferik/gems' + gem.authors = ["Erik Michaels-Ober"] + gem.email = ['sferik@gmail.com'] + gem.description = %q{Ruby wrapper for the RubyGems.org API} + gem.summary = gem.description + gem.homepage = 'https://github.com/sferik/gems' - gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - gem.name = 'gems' - gem.require_paths = ['lib'] - gem.version = Gems::VERSION + gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + gem.files = `git ls-files`.split("\n") + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.name = 'gems' + gem.require_paths = ['lib'] + gem.required_ruby_version = '>= 1.9' + gem.version = Gems::VERSION end diff --git a/lib/gems/client.rb b/lib/gems/client.rb index 7b9fee4..9da6e6b 100644 --- a/lib/gems/client.rb +++ b/lib/gems/client.rb @@ -1,7 +1,7 @@ require 'date' require 'gems/configuration' require 'gems/request' -require 'multi_json' +require 'json' require 'yaml' module Gems @@ -49,7 +49,7 @@ def search(query) # Gems.versions 'coulda' def versions(gem_name) response = get("/api/v1/versions/#{gem_name}.json") - MultiJson.decode(response) + JSON.parse(response) end # Returns the total number of downloads for a particular gem