Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add bundler parallel install option #61

Merged
merged 3 commits into from Sep 4, 2013

Conversation

Projects
None yet
2 participants
Contributor

sanemat commented Aug 26, 2013

bundler v1.4.0.pre.1 acquires parallel bundle install. This makes appraisal:install faster!

@sikachu sikachu and 1 other commented on an outdated diff Aug 26, 2013

lib/appraisal/appraisal.rb
@@ -49,5 +50,11 @@ def gemfile_root
def clean_name
name.gsub(/[^\w\.]/, '_')
end
+
+ def bundle_parallel_option
+ if Gem::Version.create(Bundler::VERSION) >= Gem::Version.create('1.4.0.pre.1')
+ '--jobs=4'
@sikachu

sikachu Aug 26, 2013

Contributor

Let's add parallel gem and use Parallel.processor_count to determine the number of cores. (http://stackoverflow.com/questions/891537/ruby-detect-number-of-cpus-installed#comment8434546_6420817)

@sanemat

sanemat Aug 27, 2013

Contributor

Added parallel gem for Parallel.processor_count 😁 c10b3d2

@sikachu sikachu and 1 other commented on an outdated diff Aug 26, 2013

spec/appraisal/appraisal_spec.rb
@@ -6,10 +6,19 @@
it "creates a proper bundle command" do
appraisal = Appraisal::Appraisal.new('fake', 'fake')
appraisal.stub(:gemfile_path).and_return("/home/test/test directory")
+ appraisal.stub(:bundle_parallel_option).and_return(nil)
@sikachu

sikachu Aug 26, 2013

Contributor

If you add parallel gem, then you could stub out Parallel.processor_count instead. That way, we're not stubbing system under test.

@sanemat

sanemat Aug 27, 2013

Contributor

Added parallel gem, and I stub Bundler::Version for this spec. c10b3d2
I stub Parallel.processor_count and test below.

@sanemat sanemat Add parallel gem for detecting the count of cpu cores
Use the count of cpu cores for `bundle install` parallel jobs,
because bundler v1.4.0.pre.1 provides parallel install option.
c10b3d2

@sikachu sikachu merged commit c10b3d2 into thoughtbot:master Sep 4, 2013

1 check passed

default The Travis CI build passed
Details
Contributor

sikachu commented Sep 4, 2013

Merged! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment