diff options
author | Homu <homu@barosl.com> | 2016-08-09 10:24:43 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-08-09 10:24:43 +0900 |
commit | 7732687a61d4d4c5a0f07def77c0b45e7ec65a6b (patch) | |
tree | d987dd093411c3e0135513fa8a6670b95489211b | |
parent | e641c5a073ef255be9bec2b20eb16a33791512a4 (diff) | |
parent | 869602fcba53421e1162c449ac8f4a1ecb3119f8 (diff) | |
download | bundler-7732687a61d4d4c5a0f07def77c0b45e7ec65a6b.tar.gz |
Auto merge of #4840 - bundler:seg-unlock-locals, r=indirect
Unlock sources when a local override leads to changes
Closes #4838.
Requires tests
-rw-r--r-- | lib/bundler/definition.rb | 5 | ||||
-rw-r--r-- | lib/bundler/installer/parallel_installer.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 21 |
3 files changed, 25 insertions, 3 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 36bb9f2ef8..726e9d261b 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -555,9 +555,10 @@ module Bundler end end - locals.any? do |source, changed| + sources_with_changes = locals.select do |source, changed| changed || specs_changed?(source) - end + end.map(&:first) + !sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty? end def converge_paths diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index d7ade763cf..12f11bb5f0 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -139,8 +139,8 @@ module Bundler def enqueue_specs @specs.select(&:ready_to_enqueue?).each do |spec| if spec.dependencies_installed? @specs - worker_pool.enq spec spec.state = :enqueued + worker_pool.enq spec end end end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index d3ff35e982..bc9cc20870 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -250,6 +250,27 @@ describe "bundle install with git sources" do expect(out).to eq("LOCAL") end + it "unlocks the source when the dependencies have changed while switching to the local" do + build_git "rack", "0.8" + + FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + + update_git "rack", "0.8", :path => lib_path("local-rack") do |s| + s.write "rack.gemspec", build_spec("rack", "0.8") { runtime "rspec", "> 0" }.first.to_ruby + s.write "lib/rack.rb", "puts :LOCAL" + end + + install_gemfile! <<-G + source "file://#{gem_repo1}" + gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master" + G + + bundle! %(config local.rack #{lib_path("local-rack")}) + bundle! :install + run! "require 'rack'" + expect(out).to eq("LOCAL") + end + it "updates specs on runtime" do system_gems "nokogiri-1.4.2" |