buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r693280 - /incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb
Date Mon, 08 Sep 2008 21:31:45 GMT
Author: assaf
Date: Mon Sep  8 14:31:44 2008
New Revision: 693280

URL: http://svn.apache.org/viewvc?rev=693280&view=rev
Log:
RSpec test framework now expects you to either run with JRuby or have JRUBY_HOME set.

Modified:
    incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb

Modified: incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb?rev=693280&r1=693279&r2=693280&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/bdd_frameworks.rb Mon Sep  8 14:31:44 2008
@@ -61,7 +61,7 @@
 
     
     REQUIRES = []
-    REQUIRES.unshift 'org.jruby:jruby-complete:jar:1.1.1' unless RUBY_PLATFORM =~ /java/
+    # REQUIRES.unshift 'org.jruby:jruby-complete:jar:1.1.1' unless RUBY_PLATFORM =~ /java/
     
     TESTS_PATTERN = [ /_spec.rb$/ ]
     OPTIONS = [:properties, :java_args]
@@ -79,33 +79,23 @@
     end
 
     def run(tests, dependencies) #:nodoc:
+      jruby_home or fail "To use RSpec you must either run on JRuby or have JRUBY_HOME set"
       cmd_options = task.options.only(:properties, :java_args)
       dependencies.push *Dir.glob(File.join(jruby_home, "lib/*.jar")) if RUBY_PLATFORM =~
/java/
       cmd_options.update :classpath => dependencies, :project => task.project
 
-      # TODO:  Setting up JRuby is something to do before running Buildr.
-      #install_gems(cmd_options)
-
       report_dir = task.report_to.to_s
       FileUtils.rm_rf report_dir
       ENV['CI_REPORTS'] = report_dir
 
-      jruby("-Ilib", "-S", "spec",
-      "--require", "ci/reporter/rake/rspec_loader",
-      "--format", "CI::Reporter::RSpecDoc", tests,
-      cmd_options.merge({:name => "RSpec"}))
+      jruby '-Ilib', '-S', 'spec', '--require', 'ci/reporter/rake/rspec_loader',
+        '--format', 'CI::Reporter::RSpecDoc', tests, cmd_options.merge(:name => 'RSpec')
       tests
     end
 
     private
     def jruby_home
-      @jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] : File.expand_path(".jruby",
ENV['HOME'])
-    end
-
-    def gem_path(project, gem_name, *additional)
-      dir = Dir["#{jruby_home(project)}/lib/ruby/gems/1.8/gems/#{gem_name}*"].to_a.first
-      dir = File.join(dir, *additional) unless additional.empty?
-      dir
+      @jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] : ENV['JRUBY_HOME']
     end
 
     def required_gems(options)
@@ -120,18 +110,10 @@
       cmd_options[:java_args] ||= []
       cmd_options[:java_args] << "-Xmx512m" unless cmd_options[:java_args].detect {|a|
a =~ /^-Xmx/}
       cmd_options[:properties] ||= {}
-      cmd_options[:properties]["jruby.home"] = jruby_home
+      cmd_options[:properties]['jruby.home'] = jruby_home
       Java::Commands.java(*java_args)
     end
 
-    #def install_gems(options)
-    #  unless required_gems(options).all? {|g| gem_path(options[:project], g)}
-    #    args = ["-S", "maybe_install_gems", *required_gems(options)]
-    #    args << {:name => "JRuby Setup"}.merge(options)
-    #    jruby(*args)
-    #  end
-    #end
-    
   end
 
   class JtestR < TestFramework::Base



Mime
View raw message