summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2013-08-26 22:57:48 -0400
committerTerence Lee <hone02@gmail.com>2013-08-27 18:00:14 -0400
commite75f1c7d995a2dec01b8998a02b2cc871ad1778f (patch)
treeadd8259d24818a12d99783423f245b5f67a505b6
parent47af7f14335446a0410e3ad76592bc605a6b54fe (diff)
downloadbundler-e75f1c7d995a2dec01b8998a02b2cc871ad1778f.tar.gz
show which worker the install came from in DEBUG mode
-rw-r--r--lib/bundler/installer.rb10
-rw-r--r--lib/bundler/parallel_workers/unix_worker.rb4
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 1fc92441c8..8b642e6998 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -101,7 +101,7 @@ module Bundler
generate_standalone(options[:standalone]) if options[:standalone]
end
- def install_gem_from_spec(spec, standalone = false)
+ def install_gem_from_spec(spec, standalone = false, worker = 0)
# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
@@ -115,7 +115,7 @@ module Bundler
install_message, post_install_message, debug_message = spec.source.install(spec)
Bundler.ui.info install_message
Bundler.ui.debug debug_message if debug_message
- Bundler.ui.debug " #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
+ Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
end
if Bundler.settings[:bin] && standalone
@@ -263,7 +263,7 @@ module Bundler
def install_sequentially(standalone)
specs.each do |spec|
- message = install_gem_from_spec spec, standalone
+ message = install_gem_from_spec spec, standalone, 0
if message
Installer.post_install_messages[spec.name] = message
end
@@ -279,9 +279,9 @@ module Bundler
remains[spec.name] = true
end
- worker_pool = ParallelWorkers.worker_pool size, lambda { |name|
+ worker_pool = ParallelWorkers.worker_pool size, lambda { |name, worker|
spec = name2spec[name]
- message = install_gem_from_spec spec, standalone
+ message = install_gem_from_spec spec, standalone, worker
{ :name => spec.name, :post_install => message }
}
specs.each do |spec|
diff --git a/lib/bundler/parallel_workers/unix_worker.rb b/lib/bundler/parallel_workers/unix_worker.rb
index 1d5fee6697..c7f3f33304 100644
--- a/lib/bundler/parallel_workers/unix_worker.rb
+++ b/lib/bundler/parallel_workers/unix_worker.rb
@@ -22,7 +22,7 @@ module Bundler
# @param size [Integer] Size of worker pool
# @param func [Proc] Job that should be executed in the worker
def prepare_workers(size, func)
- @workers = size.times.map do
+ @workers = size.times.map do |num|
child_read, parent_write = IO.pipe
parent_read, child_write = IO.pipe
@@ -33,7 +33,7 @@ module Bundler
while !child_read.eof?
obj = Marshal.load child_read
- Marshal.dump func.call(obj), child_write
+ Marshal.dump func.call(obj, num), child_write
end
rescue Exception => e
begin