diff options
author | Tim Moore <tmoore@incrementalism.net> | 2015-04-25 08:33:58 +1000 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-04-29 20:51:39 -0700 |
commit | 1a82dd9250d8c7e0d5bfe0d125825155c6c8aaa7 (patch) | |
tree | 27441500f8834b21197b9ff20bc581be0b50b375 /lib | |
parent | 70fca61c94eb15c6435062c963652cc28638a82c (diff) | |
download | bundler-1a82dd9250d8c7e0d5bfe0d125825155c6c8aaa7.tar.gz |
Replace locked gem sources with Gemfile equivalents.
Previously, an up-to-date lock file would retain the aggregate gem
source on all dependencies, so if the gems were not installed locally,
you'd get an ambiguous gem warning and possibly the wrong source
selected.
Fixes #3585
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/definition.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index e9d5d0b6..86dbfba2 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -184,11 +184,10 @@ module Bundler # @return [SpecSet] resolved dependencies def resolve @resolve ||= begin + last_resolve = converge_locked_specs if Bundler.settings[:frozen] || (!@unlocking && nothing_changed?) - @locked_specs + last_resolve else - last_resolve = converge_locked_specs - # Run a resolve against the locally available gems last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve) end @@ -521,7 +520,9 @@ module Bundler converged = [] @locked_specs.each do |s| - s.source = sources.get(s.source) + # Replace the locked dependency's source with the equivalent source from the Gemfile + dep = @dependencies.find { |dep| s.satisfies?(dep) } + s.source = (dep && dep.source) || sources.get(s.source) # Don't add a spec to the list if its source is expired. For example, # if you change a Git gem to Rubygems. @@ -569,7 +570,7 @@ module Bundler end def satisfies_locked_spec?(dep) - @locked_specs.any? { |s| s.satisfies?(dep) && (!dep.source || s.source == dep.source) } + @locked_specs.any? { |s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) } end def expanded_dependencies |