summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2012-11-13 10:40:57 -0800
committerAndre Arko <andre@arko.net>2012-11-13 10:40:57 -0800
commit58cd87d5970a3e86766774783041505d4511ea0b (patch)
tree3a5b473f8bbf71cd3f71c243f321a1e80c383b65 /lib
parent4b4916c03b75674f06a15e1180334756b96dfca8 (diff)
downloadbundler-58cd87d5970a3e86766774783041505d4511ea0b.tar.gz
delay loading rubygems/format until we use it
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/rubygems_integration.rb3
-rw-r--r--lib/bundler/source/rubygems.rb8
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index d0ad0359b7..35e09d4200 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -101,7 +101,10 @@ module Bundler
end
def spec_from_gem(path)
+ require 'rubygems/format'
Gem::Format.from_file_by_path(path).spec
+ rescue Gem::Package::FormatError
+ raise Bundler::GemspecError, "Could not read gem at #{path}. It may be corrupted."
end
def download_gem(spec, uri, path)
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 3455f4d296..aaabeed0c3 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -204,13 +204,7 @@ module Bundler
path = Bundler.app_cache
Dir["#{path}/*.gem"].each do |gemfile|
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
-
- begin
- s ||= Bundler.rubygems.spec_from_gem(gemfile)
- rescue Gem::Package::FormatError
- raise GemspecError, "Could not read gem at #{gemfile}. It may be corrupted."
- end
-
+ s ||= Bundler.rubygems.spec_from_gem(gemfile)
s.source = self
idx << s
end