Skip to content

Commit

Permalink
Fix rubygems#2813: Ignore self dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
eagletmt committed Jan 10, 2014
1 parent 706c9d3 commit 338357d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/bundler/installer.rb
Expand Up @@ -285,8 +285,7 @@ def install_in_parallel(size, standalone)
{ :name => spec.name, :post_install => message }
}
specs.each do |spec|
deps = spec.dependencies.select { |dep| dep.type != :development }
if deps.empty?
if ready_to_install?(spec, remains)
worker_pool.enq spec.name
enqueued[spec.name] = true
end
Expand All @@ -301,8 +300,7 @@ def install_in_parallel(size, standalone)
remains.keys.each do |name|
next if enqueued[name]
spec = name2spec[name]
deps = spec.dependencies.select { |dep| remains[dep.name] and dep.type != :development }
if deps.empty?
if ready_to_install?(spec, remains)
worker_pool.enq name
enqueued[name] = true
end
Expand All @@ -312,5 +310,11 @@ def install_in_parallel(size, standalone)
ensure
worker_pool && worker_pool.stop
end

def ready_to_install?(spec, remains)
spec.dependencies.none? do |dep|
remains[dep.name] && dep.type != :development && dep.name != spec.name
end
end
end
end
15 changes: 14 additions & 1 deletion spec/realworld/parallel_install_spec.rb
Expand Up @@ -12,12 +12,25 @@
(0..1).each {|i| expect(out).to include("#{i}: ") }

bundle "show activesupport"
expect(out).to match(/activesupport/)
expect(out).to match(%r{gems/activesupport})

bundle "show faker"
expect(out).to match(/faker/)

bundle "config jobs"
expect(out).to match(/: "2"/)
end

it 'installs even with circular dependency' do
gemfile <<-G
source 'https://rubygems.org'
gem 'mongoid_auto_increment', "0.1.1"
G

bundle :install, :jobs => 2, :env => {"DEBUG" => "1"}
(0..1).each {|i| expect(out).to include("#{i}: ") }

bundle "show mongoid_auto_increment"
expect(out).to match(%r{gems/mongoid_auto_increment})
end
end

0 comments on commit 338357d

Please sign in to comment.