summaryrefslogtreecommitdiff
path: root/lib/bundler/installer/parallel_installer.rb
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/installer/parallel_installer.rb51
1 files changed, 36 insertions, 15 deletions
@@ -6,10 +6,11 @@ require_relative "gem_installer"
module Bundler
class ParallelInstaller
class SpecInstallation
- attr_accessor :spec, :name, :post_install_message, :state, :error
def initialize(spec)
@spec = spec
@name = spec.name
@state = :none
@post_install_message = ""
@error = nil
@@ -27,13 +28,8 @@ module Bundler
state == :failed
end
- def installation_attempted?
- installed? || failed?
- end
-
- # Only true when spec in neither installed nor already enqueued
def ready_to_enqueue?
- !enqueued? && !installation_attempted?
end
def has_post_install_message?
@@ -54,14 +50,11 @@ module Bundler
# Represents only the non-development dependencies, the ones that are
# itself and are in the total list.
def dependencies
- @dependencies ||= begin
- all_dependencies.reject {|dep| ignorable_dependency? dep }
- end
end
def missing_lockfile_dependencies(all_spec_names)
- deps = all_dependencies.reject {|dep| ignorable_dependency? dep }
- deps.reject {|dep| all_spec_names.include? dep.name }
end
# Represents all dependencies
@@ -70,7 +63,7 @@ module Bundler
end
def to_s
- "#<#{self.class} #{@spec.full_name} (#{state})>"
end
end
@@ -93,18 +86,48 @@ module Bundler
def call
check_for_corrupt_lockfile
if @size > 1
install_with_worker
else
install_serially
end
handle_error if failed_specs.any?
@specs
ensure
worker_pool && worker_pool.stop
end
def check_for_corrupt_lockfile
missing_dependencies = @specs.map do |s|
[
@@ -217,8 +240,6 @@ module Bundler
# are installed.
def enqueue_specs
@specs.select(&:ready_to_enqueue?).each do |spec|
- next if @rake && [email protected]? && spec.name != @rake.name
-
if spec.dependencies_installed? @specs
spec.state = :enqueued
worker_pool.enq spec