diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-04-29 11:54:58 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-04-30 00:36:57 -0700 |
commit | 18b25725eb43da35863ee851b7fefd9b1d144347 (patch) | |
tree | 5bfd6f7477b4a98302ba95237044c6ceef208323 | |
parent | e9bafedd51e15915427442f09d662b10b3fef14f (diff) | |
download | bundler-18b25725eb43da35863ee851b7fefd9b1d144347.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.rb | 8 |
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) |