summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Arko <mail@arko.net>2015-02-22 13:17:41 -0800
committerAndré Arko <mail@arko.net>2015-02-22 13:17:41 -0800
commit8ca8ee09997a46e3959145c9d00d74a374913b71 (patch)
tree4f55ae19fee2533de1518532289b92ef0b7df3ad
parent5b30fed7673ea5a7709e418484e78aafa4f5a9b6 (diff)
parentd0a21a0563c9fb7061ac98a30277157bc9160116 (diff)
downloadbundler-8ca8ee09997a46e3959145c9d00d74a374913b71.tar.gz
Merge pull request #3427 from TimMoore/issue-3414-fix-multi-source-unlocking
Fix multi source unlocking
-rw-r--r--lib/bundler/definition.rb11
-rw-r--r--spec/install/gems/sources_spec.rb20
2 files changed, 29 insertions, 2 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 59f8a69d77..4c15866577 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -406,11 +406,18 @@ module Bundler
if locked
unlocking = @locked_specs.any? do |locked_spec|
- locked_spec.source != locked
+ locked_spec.source.class == locked.class && locked_spec.source != locked
end
end
- !locked || unlocking || source.specs != locked.specs
+ !locked || unlocking || dependencies_for_source_changed?(locked) || source.specs != locked.specs
+ end
+
+ def dependencies_for_source_changed?(source)
+ deps_for_source = @dependencies.select { |s| s.source == source }
+ locked_deps_for_source = @locked_deps.select { |s| s.source == source }
+
+ deps_for_source != locked_deps_for_source
end
# Get all locals and override their matching sources.
diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb
index 45a742a87f..cca00a914d 100644
--- a/spec/install/gems/sources_spec.rb
+++ b/spec/install/gems/sources_spec.rb
@@ -281,6 +281,26 @@ describe "bundle install with gems on multiple sources" do
should_be_installed("rack 0.9.1")
end
end
+
+ context "with a path gem in the same Gemfile" do
+ before do
+ build_lib "foo"
+
+ gemfile <<-G
+ gem "rack", :source => "file://#{gem_repo1}"
+ gem "foo", :path => "#{lib_path('foo-1.0')}"
+ G
+ end
+
+ it "does not unlock the non-path gem after install" do
+ bundle :install
+
+ bundle %{exec ruby -e 'puts "OK"'}
+
+ expect(out).to include("OK")
+ expect(exitstatus).to eq(0) if exitstatus
+ end
+ end
end
context "when an older version of the same gem also ships with Ruby" do