diff options
author | Hemant Kumar <gethemant@gmail.com> | 2013-07-30 01:35:21 +0530 |
---|---|---|
committer | Hemant Kumar <gethemant@gmail.com> | 2013-07-30 01:35:21 +0530 |
commit | eb30f11a1ab5426eebf5160cfed6e6e3fcd7b0b5 (patch) | |
tree | c717d0f63baa76b38090be359673f7eee306b27e /lib/bundler/installer.rb | |
parent | a31e6076211d56e6a5784aadf6018ae234bed8a5 (diff) | |
download | bundler-eb30f11a1ab5426eebf5160cfed6e6e3fcd7b0b5.tar.gz |
Do not use parallel installation on unsupported systems
1. Use parallel installation on MRI if asked.
2. On non-MRI check for rubygems version that is threadsafe
Diffstat (limited to 'lib/bundler/installer.rb')
-rw-r--r-- | lib/bundler/installer.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 3fdde46c40..63890528a8 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -91,7 +91,8 @@ module Bundler size = options[:jobs] || 1 size = [size, 1].max - if size > 1 + + if size > 1 && can_install_parallely? install_in_parallel size, options[:standalone] else install_sequentially options[:standalone] @@ -190,6 +191,17 @@ module Bundler end private + def can_install_parallely? + if Bundler.current_ruby.mri? || Gem::VERSION >= "2.1.0" + true + else + Bundler.ui.warn "Bundler has detected Rubygems version #{Gem::VERSION} which is " \ + "old and not threadsafe and thus Bundler can't proceed with parallel" \ + "gem installation. Install Rubygems version >= 2.1.0 for parallel"\ + "installation, Bundler will now resume installation by using serial method." + false + end + end def generate_standalone_bundler_executable_stubs(spec) # double-assignment to avoid warnings about variables that will be used by ERB |