Add bundle parallel config
This commit is contained in:
parent
5d72a8c5a4
commit
fc6188d777
25
Rakefile
25
Rakefile
@ -31,6 +31,8 @@ task :install => [:submodule_init, :submodules] do
|
||||
|
||||
install_term_theme if RUBY_PLATFORM.downcase.include?("darwin")
|
||||
|
||||
run_bundle_config
|
||||
|
||||
success_msg("installed")
|
||||
end
|
||||
|
||||
@ -117,6 +119,29 @@ def run(cmd)
|
||||
`#{cmd}` unless ENV['DEBUG']
|
||||
end
|
||||
|
||||
def number_of_cores
|
||||
puts "======================================================"
|
||||
puts "Calculating number of cores"
|
||||
puts "======================================================"
|
||||
|
||||
if RUBY_PLATFORM.downcase.include?("darwin")
|
||||
cores = run %{ sysctl -n hw.ncpu }
|
||||
else
|
||||
cores = run %{ nproc }
|
||||
end
|
||||
puts
|
||||
cores.to_i
|
||||
end
|
||||
|
||||
def run_bundle_config
|
||||
bundler_jobs = number_of_cores - 1
|
||||
puts "======================================================"
|
||||
puts "Configuring Bundlers for parallel gem installation"
|
||||
puts "======================================================"
|
||||
run %{ bundle config --global jobs #{bundler_jobs} }
|
||||
puts
|
||||
end
|
||||
|
||||
def install_rvm_binstubs
|
||||
puts "======================================================"
|
||||
puts "Installing RVM Bundler support. Never have to type"
|
||||
|
Loading…
Reference in New Issue
Block a user