Skip to content

Commit

Permalink
implemented support to Rubygems dependencies API.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanob authored and tomlea committed Mar 8, 2012
1 parent 34993a7 commit f460720
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/geminabox.rb
Expand Up @@ -42,6 +42,20 @@ def fixup_bundler_rubygems!
erb :atom, :layout => false
end

get '/api/v1/dependencies' do
query_gems = params[:gems].split(',')
deps = load_gems.gems.select {|gem| query_gems.include?(gem.name) }.map do |gem|
spec = spec_for(gem.name, gem.number)
{
:name => gem.name,
:number => gem.number.version,
:platform => gem.platform,
:dependencies => spec.dependencies.select {|dep| dep.type == :runtime}.map {|dep| [dep.name, dep.requirement.to_s] }
}
end
Marshal.dump(deps)
end

get '/upload' do
erb :upload
end
Expand Down

0 comments on commit f460720

Please sign in to comment.