Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Filter gems with nil specs out of the dependency report -- fixes crash

  • Loading branch information...
commit 5939e48101b8bce706a6cd68ef80c1bf85ea5316 1 parent e636bc6
@jfoy jfoy authored
Showing with 19 additions and 9 deletions.
  1. +19 −9 lib/geminabox.rb
View
28 lib/geminabox.rb
@@ -242,16 +242,26 @@ def spec_for(gem_name, version)
# 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
+ load_gems.
+ select { |gem| gem_name == gem.name }.
+ map { |gem| [gem, spec_for(gem.name, gem.number)] }.
+ reject { |(_, spec)| spec.nil? }.
+ map do |(gem, spec)|
+ {
+ :name => gem.name,
+ :number => gem.number.version,
+ :platform => gem.platform,
+ :dependencies => runtime_dependencies(spec)
+ }
+ end
end
end
+
+ def runtime_dependencies(spec)
+ spec.
+ dependencies.
+ select { |dep| dep.type == :runtime }.
+ map { |dep| [dep.name, dep.requirement.to_s] }
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.