From ec1caf1a197973eff51923d59044a46a358c2143 Mon Sep 17 00:00:00 2001 From: grosser Date: Sat, 20 Oct 2012 12:20:44 -0700 Subject: [PATCH] check and only install if necessary -> faster --- lib/appraisal/appraisal.rb | 3 ++- spec/appraisal/appraisal_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/appraisal/appraisal.rb b/lib/appraisal/appraisal.rb index 657202ca..a59f5c54 100644 --- a/lib/appraisal/appraisal.rb +++ b/lib/appraisal/appraisal.rb @@ -37,7 +37,8 @@ def gemfile_path end def bundle_command - "bundle install --gemfile='#{gemfile_path}'" + gemfile = "--gemfile='#{gemfile_path}'" + "bundle check #{gemfile} || bundle install #{gemfile}" end private diff --git a/spec/appraisal/appraisal_spec.rb b/spec/appraisal/appraisal_spec.rb index 2f2e05de..07d751f6 100644 --- a/spec/appraisal/appraisal_spec.rb +++ b/spec/appraisal/appraisal_spec.rb @@ -6,7 +6,7 @@ appraisal = Appraisal::Appraisal.new('fake', 'fake') appraisal.stub(:gemfile_path).and_return("/home/test/test directory") - appraisal.bundle_command.should == "bundle install --gemfile='/home/test/test directory'" + appraisal.bundle_command.should == "bundle check --gemfile='/home/test/test directory' || bundle install --gemfile='/home/test/test directory'" end it "cleans up spaces and punctuation when outputting its gemfile" do