summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Moore <tmoore@incrementalism.net>2014-11-16 23:36:45 +1100
committerTim Moore <tmoore@incrementalism.net>2014-12-11 16:56:03 +1100
commit5351e8f3993e27d2994b4a50ae429766c0a2df51 (patch)
tree3e226090dc5d073c8083131b8e1844acdac99fd9
parenta5ad4e650d977d8881f95cf026ce7b8fe6ff2238 (diff)
downloadbundler-5351e8f3993e27d2994b4a50ae429766c0a2df51.tar.gz
Convert sources to lock format before comparing.
If the Gemfile sources lock to the same result as the current locked sources, they haven't changed. Closes #3298.
-rw-r--r--lib/bundler/source_list.rb4
-rw-r--r--spec/install/gems/sources_spec.rb32
2 files changed, 34 insertions, 2 deletions
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 05e2251fec..49a976ba6a 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -59,10 +59,10 @@ module Bundler
replacement_rubygems =
replacement_sources.detect { |s| s.is_a?(Source::Rubygems) }
- @rubygems_aggregate = replacement_rubygems
+ @rubygems_aggregate = replacement_rubygems if replacement_rubygems
# Return true if there were changes
- all_sources.to_set != replacement_sources.to_set ||
+ lock_sources.to_set != replacement_sources.to_set ||
rubygems_remotes.to_set != replacement_rubygems.remotes.to_set
end
diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb
index e3ab84c0aa..376b105579 100644
--- a/spec/install/gems/sources_spec.rb
+++ b/spec/install/gems/sources_spec.rb
@@ -239,6 +239,38 @@ describe "bundle install with gems on multiple sources" do
expect(out).to include("Could not find gem 'not_in_repo1 (>= 0) ruby'")
end
end
+
+ context "with an existing lockfile" do
+ before do
+ system_gems "rack-0.9.1", "rack-1.0.0"
+
+ lockfile <<-L
+ GEM
+ remote: file:#{gem_repo1}
+ remote: file:#{gem_repo3}
+ specs:
+ rack (0.9.1)
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+ rack!
+ L
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ source "file://#{gem_repo3}" do
+ gem 'rack'
+ end
+ G
+ end
+
+ # Reproduction of https://github.com/bundler/bundler/issues/3298
+ it "does not unlock the installed gem on exec" do
+ should_be_installed("rack 0.9.1")
+ end
+ end
end
context "when an older version of the same gem also ships with Ruby" do