From fc6188d777c6111e71d8defa1da0674d48ae047f Mon Sep 17 00:00:00 2001 From: Paul Sorensen Date: Mon, 3 Feb 2014 10:30:23 -0600 Subject: [PATCH] Add bundle parallel config --- Rakefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Rakefile b/Rakefile index 6d026f1..11aa124 100644 --- a/Rakefile +++ b/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"