Author: donaldp
Date: Sat May 19 04:08:21 2012
New Revision: 1340340

URL: http://svn.apache.org/viewvc?rev=1340340&view=rev
Log:
Update test infrastructure so that it uses rvm to run tests. Update staging 
process so that it runs tests against our 3 blessed platforms

Modified:
    buildr/trunk/rakelib/rspec.rake
    buildr/trunk/rakelib/stage.rake

Modified: buildr/trunk/rakelib/rspec.rake
URL: 
http://svn.apache.org/viewvc/buildr/trunk/rakelib/rspec.rake?rev=1340340&r1=1340339&r2=1340340&view=diff
==============================================================================
--- buildr/trunk/rakelib/rspec.rake (original)
+++ buildr/trunk/rakelib/rspec.rake Sat May 19 04:08:21 2012
@@ -65,18 +65,33 @@ begin
   desc 'Run all specs with CI reporter'
   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}"
+    end
+  end
+
   # Useful for testing with JRuby when using Ruby and vice versa.
   namespace :spec do
-    desc "Run all specs specifically with Ruby"
-    task :ruby do
+    desc "Run all specs specifically with Ruby 1.9"
+    task :ruby_1_9 do
+      puts "Running test suite using Ruby ..."
+      rvm_run_in("ruby-1.9.2-p320@buildr", "rake spec")
+    end
+
+    desc "Run all specs specifically with Ruby 1.8"
+    task :ruby_1_8 do
       puts "Running test suite using Ruby ..."
-      sh 'ruby -S rake spec'
+      rvm_run_in("ruby-1.8.7-p358@buildr", "rake spec")
     end
 
     desc "Run all specs specifically with JRuby"
     task :jruby do
       puts "Running test suite using JRuby ..."
-      sh 'jruby -S rake spec'
+      rvm_run_in("ruby-1.6.7@buildr", "rake spec")
     end
   end
 

Modified: buildr/trunk/rakelib/stage.rake
URL: 
http://svn.apache.org/viewvc/buildr/trunk/rakelib/stage.rake?rev=1340340&r1=1340339&r2=1340340&view=diff
==============================================================================
--- buildr/trunk/rakelib/stage.rake (original)
+++ buildr/trunk/rakelib/stage.rake Sat May 19 04:08:21 2012
@@ -56,12 +56,11 @@ task :prepare do |task, args|
 
   # Need JRuby, Scala and Groovy installed to run all the specs.
   lambda do
-    puts "Checking that we have JRuby, Scala and Groovy available ... "
-    sh 'jruby --version'
+    puts "Checking that we have Scala and Groovy available ... "
     `scala -version`
     $?.exitstatus == 1 or fail "Scala is not installed"
     sh 'groovy -version'
-    puts "[X] We have JRuby, Scala and Groovy"
+    puts "[X] We have Scala and Groovy"
   end.call
 
   # Need Prince to generate PDF
@@ -80,10 +79,11 @@ task :prepare do |task, args|
   end.call
 
   # We will be speccing in one platform, so also spec the other one.
-  task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the 
*other* platform
+  task('spec:ruby_1_9').invoke unless RUBY_VERSION >= '1.9' && 
!RUBY_PLATFORM[/java/]
+  task('spec:ruby_1_8').invoke unless RUBY_VERSION >= '1.8.7' && 
!RUBY_PLATFORM[/java/]
+  task('spec:jruby').invoke unless RUBY_PLATFORM[/java/]
 end
 
-
 task :stage=>[:clobber, :prepare] do |task, args|
   gpg_arg = args.gpg || ENV['gpg']
   mkpath '_staged'


Reply via email to