Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Unlock specs that don't exist in the path source anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Lerche committed Jun 23, 2010
1 parent 2eeff95 commit d9c8f02
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def converge_locked_specs
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
Expand Down
8 changes: 8 additions & 0 deletions lib/bundler/index.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Bundler
class Index
include Enumerable

def self.build
i = new
yield i
Expand Down Expand Up @@ -79,6 +81,12 @@ def use(other)
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)
Expand Down
31 changes: 31 additions & 0 deletions spec/install/path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,35 @@
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

0 comments on commit d9c8f02

Please sign in to comment.