summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-04-29 11:54:58 -0700
committerAndre Arko <andre@arko.net>2015-04-30 00:37:10 -0700
commitc9a38adc1859307e31f02219a657fd62db4e7c81 (patch)
tree0e0e7604a403e7ec109e1bf7c843dd4f68b0f3e8
parent4d25dc95fea641201d0032b509afea04231eaec7 (diff)
downloadbundler-c9a38adc1859307e31f02219a657fd62db4e7c81.tar.gz
loop through the spec list to find gems with a certain name
Since rubygems/rubygems@4fa03bb7aac9f25f44394e818433fdda9962ae8d rubygems lazily loads specs from the filesystem for a particular name. So if you request the "foo" gem, then rubygems will go to the FS and find the gemspecs with the "foo" name. **Before** the change, rubygems would search through the loaded spec list for a gem with that name. Bundler assumed that rubygems would always search through that spec list, so it sets the specs and relies on that internal behavior. Since the internal behavior changed, we need to take that in to account in the bundler internals. This patch changes bundler to search through the spec list for a gem with a particular name. Gem::Specification.stubs should be supported in the future (though not recommended because loading every spec isn't super performant).
-rw-r--r--lib/bundler/rubygems_integration.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index ef9ac0a2c7..15d43c38a2 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -467,7 +467,9 @@ module Bundler
end
def find_name(name)
- Gem::Specification.find_all_by_name name
+ Gem::Specification.stubs.find_all { |spec|
+ spec.name == name
+ }.map(&:to_spec)
end
end
@@ -508,7 +510,9 @@ module Bundler
end
def find_name(name)
- Gem::Specification.find_all_by_name name
+ Gem::Specification.stubs.find_all { |spec|
+ spec.name == name
+ }.map(&:to_spec)
end
def fetch_specs(source, name)