summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-07-20 15:29:51 -0700
committerCarlhuda <carlhuda@engineyard.com>2010-07-20 15:29:51 -0700
commit499025206d31837b0afe014f79b8ff68b14e7849 (patch)
treef00a6caa98748b735878453adca617deba44494a
parent9a196d1894ea15795851ee293a367ed5c5e1b144 (diff)
downloadbundler-499025206d31837b0afe014f79b8ff68b14e7849.tar.gz
Fix a bug with ordering of sources between the lockfile and the gemfile
-rw-r--r--lib/bundler/definition.rb4
-rw-r--r--spec/install/path_spec.rb24
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 9b91c30057..8913847e07 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -185,7 +185,9 @@ module Bundler
end
def converge_sources
- @sources = (@locked_sources & @sources) | @sources
+ @sources.map! do |source|
+ @locked_sources.find { |s| s == source } || source
+ end
@sources.each do |source|
source.unlock! if source.respond_to?(:unlock!) && @unlock[:sources].include?(source.name)
end
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb
index 38b778b051..790166cbbf 100644
--- a/spec/install/path_spec.rb
+++ b/spec/install/path_spec.rb
@@ -260,4 +260,28 @@ describe "bundle install with explicit source paths" do
should_be_installed "foo 1.0", "bar 2.0"
end
end
+
+ describe "switching sources" do
+ it "doesn't switch pinned git sources to rubygems when pinning the parent gem to a path source" do
+ build_gem "foo", "1.0", :to_system => true do |s|
+ s.write "lib/foo.rb", "raise 'fail'"
+ end
+ build_lib "foo", "1.0", :path => lib_path('bar/foo')
+ build_git "bar", "1.0", :path => lib_path('bar') do |s|
+ s.add_dependency 'foo'
+ end
+
+ install_gemfile <<-G
+ source "http://#{gem_repo1}"
+ gem "bar", :git => "#{lib_path('bar')}"
+ G
+
+ install_gemfile <<-G
+ source "http://#{gem_repo1}"
+ gem "bar", :path => "#{lib_path('bar')}"
+ G
+
+ should_be_installed "foo 1.0", "bar 1.0"
+ end
+ end
end