You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/05/20 02:14:42 UTC

svn commit: r1340599 - /buildr/trunk/rakelib/rspec.rake

Author: donaldp
Date: Sun May 20 00:14:42 2012
New Revision: 1340599

URL: http://svn.apache.org/viewvc?rev=1340599&view=rev
Log:
Rework the way we invoke the spec runner so that the budler cache is eliminated prior to a run

Modified:
    buildr/trunk/rakelib/rspec.rake

Modified: buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/rspec.rake?rev=1340599&r1=1340598&r2=1340599&view=diff
==============================================================================
--- buildr/trunk/rakelib/rspec.rake (original)
+++ buildr/trunk/rakelib/rspec.rake Sun May 20 00:14:42 2012
@@ -66,11 +66,14 @@ begin
   task :ci=>[:load_ci_reporter, :spec]
 
   def rvm_run_in(version, command)
-    current_rvm = `rvm current`.strip
-    begin
-      sh "rvm use #{version} && #{command}"
-    ensure
-      sh "rvm use #{current_rvm}"
+    if !(Config::CONFIG['host_os'] =~ /mswin|win32|dos/i)
+      prefix = "[[ -s \"~/.rvm/scripts/rvm\" ]] && source \"~/.rvm/scripts/rvm\""
+      cmd_prefix = "rvm #{version} exec"
+      bundle = "rm Gemfile.lock; #{cmd_prefix} bundle install"
+      cmd = "#{cmd_prefix} #{command}"
+      sh "#{prefix}; #{bundle}; #{cmd}"
+    else
+      sh "#{version =~ /jruby/ ? "j" : ""}ruby -S #{command}"
     end
   end
 
@@ -91,7 +94,7 @@ begin
     desc "Run all specs specifically with JRuby"
     task :jruby do
       puts "Running test suite using JRuby ..."
-      rvm_run_in("ruby-1.6.7@buildr", "rake spec")
+      rvm_run_in("jruby-1.6.7@buildr", "rake spec")
     end
   end