summaryrefslogtreecommitdiff
path: root/lib/bundler/installer.rb
diff options
context:
space:
mode:
authorPatrick Metcalfe <git@patrickmetcalfe.com>2015-04-19 11:27:51 -0500
committerPatrick Metcalfe <git@patrickmetcalfe.com>2015-04-19 11:27:51 -0500
commit7d87d6af10f86aee3ab1630334a3fb2eacbd45ff (patch)
tree026a35e569665d08c074da9f4638d72703fb45c6 /lib/bundler/installer.rb
parentc7fce7422f467407f7544062661cbbb726b9ef38 (diff)
downloadbundler-7d87d6af10f86aee3ab1630334a3fb2eacbd45ff.tar.gz
refactor parallel installer
Diffstat (limited to 'lib/bundler/installer.rb')
-rw-r--r--lib/bundler/installer.rb43
1 files changed, 1 insertions, 42 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 7365b8f27e..a3a2eabdc3 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -277,48 +277,7 @@ module Bundler
end
def install_in_parallel(size, standalone, force = false)
- name2spec = {}
- remains = {}
- enqueued = {}
- specs.each do |spec|
- name2spec[spec.name] = spec
- remains[spec.name] = true
- end
-
- worker_pool = Worker.new size, lambda { |name, worker_num|
- spec = name2spec[name]
- message = install_gem_from_spec spec, standalone, worker_num, force
- { :name => spec.name, :post_install => message }
- }
-
- # Keys in the remains hash represent uninstalled gems specs.
- # We enqueue all gem specs that do not have any dependencies.
- # Later we call this lambda again to install specs that depended on
- # previously installed specifications. We continue until all specs
- # are installed.
- enqueue_remaining_specs = lambda do
- remains.keys.each do |name|
- next if enqueued[name]
- spec = name2spec[name]
- if ready_to_install?(spec, remains)
- worker_pool.enq name
- enqueued[name] = true
- end
- end
- end
- enqueue_remaining_specs.call
-
- until remains.empty?
- message = worker_pool.deq
- remains.delete message[:name]
- if message[:post_install]
- Installer.post_install_messages[message[:name]] = message[:post_install]
- end
- enqueue_remaining_specs.call
- end
- message
- ensure
- worker_pool && worker_pool.stop
+ ParallelInstaller.call(self, specs, size, standalone, force)
end
# We only want to install a gem spec if all its dependencies are met.