Skip to content

Commit

Permalink
Remove multi_json dependency by requiring Ruby 1.9
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sferik committed Jul 27, 2011
1 parent 266d565 commit 1362d7d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,6 @@
rvm: rvm:
- 1.8.7 - 1.9.1
- 1.9.2 - 1.9.2
- jruby - 1.9.2-head
- rbx - 1.9.3-head
- ree
- ruby-head - ruby-head
24 changes: 12 additions & 12 deletions gems.gemspec
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'simplecov', '~> 0.4'
gem.add_development_dependency 'webmock', '~> 1.6' gem.add_development_dependency 'webmock', '~> 1.6'
gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'yard', '~> 0.7'
gem.add_runtime_dependency 'multi_json', '~> 1.0.3'


gem.authors = ["Erik Michaels-Ober"] gem.authors = ["Erik Michaels-Ober"]
gem.email = ['sferik@gmail.com'] gem.email = ['sferik@gmail.com']
gem.description = %q{Ruby wrapper for the RubyGems.org API} gem.description = %q{Ruby wrapper for the RubyGems.org API}
gem.summary = gem.description gem.summary = gem.description
gem.homepage = 'https://github.com/sferik/gems' gem.homepage = 'https://github.com/sferik/gems'


gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
gem.files = `git ls-files`.split("\n") gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.name = 'gems' gem.name = 'gems'
gem.require_paths = ['lib'] gem.require_paths = ['lib']
gem.version = Gems::VERSION gem.required_ruby_version = '>= 1.9'
gem.version = Gems::VERSION
end end
4 changes: 2 additions & 2 deletions lib/gems/client.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'date' require 'date'
require 'gems/configuration' require 'gems/configuration'
require 'gems/request' require 'gems/request'
require 'multi_json' require 'json'
require 'yaml' require 'yaml'


module Gems module Gems
Expand Down Expand Up @@ -49,7 +49,7 @@ def search(query)
# Gems.versions 'coulda' # Gems.versions 'coulda'
def versions(gem_name) def versions(gem_name)
response = get("/api/v1/versions/#{gem_name}.json") response = get("/api/v1/versions/#{gem_name}.json")
MultiJson.decode(response) JSON.parse(response)
end end


# Returns the total number of downloads for a particular gem # Returns the total number of downloads for a particular gem
Expand Down

0 comments on commit 1362d7d

Please sign in to comment.