summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-04-29 11:54:58 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-04-29 11:56:33 -0700
commitc7719dd10a10cf4c60ed2512903c7ec04bc62eda (patch)
tree7497cc880bac486557e216f20186392728c2136c
parentb10636fbf2c8defdb5cebb444d1f86e8d17fe0af (diff)
downloadbundler-c7719dd10a10cf4c60ed2512903c7ec04bc62eda.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 e82311b3de..c8d274dfa0 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -480,7 +480,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
@@ -521,7 +523,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)