diff options
author | Carl Lerche <carllerche@mac.com> | 2010-06-23 16:39:06 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-06-23 16:39:06 -0700 |
commit | d9c8f028524acd8cdf5951454d3a7f46d02d960a (patch) | |
tree | ff629d62762f6e23c14d5b4722b1a70ce8ec784e | |
parent | 2eeff95e617c0bde57fab2eedfbef970b29ec9f9 (diff) | |
download | bundler-d9c8f028524acd8cdf5951454d3a7f46d02d960a.tar.gz |
Unlock specs that don't exist in the path source anymore
-rw-r--r-- | lib/bundler/definition.rb | 3 | ||||
-rw-r--r-- | lib/bundler/index.rb | 8 | ||||
-rw-r--r-- | spec/install/path_spec.rb | 31 |
3 files changed, 42 insertions, 0 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index e2ba51cf52..195bcee2c9 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -203,6 +203,9 @@ module Bundler s.source = @sources.find { |src| s.source == src } next if s.source.nil? || @unlock[:sources].include?(s.name) + # If the spec is from a path source and it doesn't exist anymore + # then we just unlock it. + next if s.source.instance_of?(Source::Path) && s.source.specs[s].empty? converged << s end diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index e615cf4053..99621335d6 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -1,5 +1,7 @@ module Bundler class Index + include Enumerable + def self.build i = new yield i @@ -79,6 +81,12 @@ module Bundler self end + def ==(o) + all? do |s| + s2 = o[s].first and (s.dependencies & s2.dependencies).empty? + end + end + private def search_by_spec(spec) diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index fc630e646f..e6908e9861 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -171,4 +171,35 @@ describe "bundle install with explicit source paths" do bundle "exec foo" out.should == "1.0" end + + describe "when the gem version in the path is updated" do + before :each do + build_lib "foo", "1.0", :path => lib_path("foo") do |s| + s.add_dependency "bar" + end + build_lib "bar", "1.0", :path => lib_path("foo/bar") + + install_gemfile <<-G + gem "foo", :path => "#{lib_path('foo')}" + G + end + + it "unlocks all gems when the top level gem is updated" do + build_lib "foo", "2.0", :path => lib_path("foo") do |s| + s.add_dependency "bar" + end + + bundle "install" + + should_be_installed "foo 2.0", "bar 1.0" + end + + it "unlocks all gems when a child dependency gem is updated" do + build_lib "bar", "2.0", :path => lib_path("foo/bar") + + bundle "install" + + should_be_installed "foo 1.0", "bar 2.0" + end + end end |