Browse files

Fix compatibility with rubygems 2.0.x

  • Loading branch information...
1 parent 4a8b322 commit 7518da10958c3a98d337ba0d8b8b7a53fb55a7a4 @tomlea tomlea committed Apr 9, 2013
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/geminabox/incoming_gem.rb
View
11 lib/geminabox/incoming_gem.rb
@@ -33,12 +33,17 @@ def valid?
end
def spec
- unless @spec
+ @spec ||= extract_spec
+ end
+
+ def extract_spec
+ if Gem::Package.respond_to? :open
Gem::Package.open(gem_data, "r", nil) do |pkg|
- @spec = pkg.metadata
+ return pkg.metadata
end
+ else
+ Gem::Package.new(@tempfile.path).spec
end
- @spec
end
def name

0 comments on commit 7518da1

Please sign in to comment.