Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Relocate gem_dependencies to helpers block

  • Loading branch information...
commit e636bc642144d8f9cfa24c728c624a9347b940cf 1 parent bf31d46
@jfoy jfoy authored
Showing with 15 additions and 15 deletions.
  1. +15 −15 lib/geminabox.rb
View
30 lib/geminabox.rb
@@ -54,21 +54,6 @@ def fixup_bundler_rubygems!
erb :atom, :layout => false
end
- # Return a list of versions of gem 'gem_name' with the dependencies of each version.
- def gem_dependencies(gem_name)
- dependency_cache.marshal_cache(gem_name) do
- load_gems.select {|gem| gem_name == 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
- end
- end
-
get '/api/v1/dependencies' do
query_gems = params[:gems].split(',')
deps = query_gems.inject([]){|memo, query_gem| memo + gem_dependencies(query_gem) }
@@ -253,5 +238,20 @@ def spec_for(gem_name, version)
spec_file = File.join(settings.data, "quick", "Marshal.#{Gem.marshal_version}", "#{gem_name}-#{version}.gemspec.rz")
Marshal.load(Gem.inflate(File.read(spec_file))) if File.exists? spec_file
end
+
+ # Return a list of versions of gem 'gem_name' with the dependencies of each version.
+ def gem_dependencies(gem_name)
+ dependency_cache.marshal_cache(gem_name) do
+ load_gems.select {|gem| gem_name == 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
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.