Author: djspiewak
Date: Tue Jun 23 00:06:54 2009
New Revision: 787485
URL: http://svn.apache.org/viewvc?rev=787485&view=rev
Log:
Use JRUBY_HOME if available (for performance)
Modified:
buildr/trunk/lib/buildr/core/shell.rb
Modified: buildr/trunk/lib/buildr/core/shell.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/shell.rb?rev=787485&r1=787484&r2=787485&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/shell.rb (original)
+++ buildr/trunk/lib/buildr/core/shell.rb Tue Jun 23 00:06:54 2009
@@ -8,6 +8,8 @@
JRUBY_VERSION = '1.1.6'
+ SUFFIX = if Util.win_os? then '.bat' else '' end
+
class << self
def lang
:none
@@ -15,18 +17,33 @@
end
def launch
- cp = project.compile.dependencies + [
- "org.jruby:jruby-complete:jar:#{JRUBY_VERSION}",
- project.path_to(:target, :classes)
- ]
-
- Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
- :properties => rebel_props(project),
- :classpath => cp,
- :java_args => rebel_args
- }
+ if jruby_home # if JRuby is installed, use it!
+ cp = project.compile.dependencies.join(File::PATH_SEPARATOR) +
+ File::PATH_SEPARATOR + project.path_to(:target, :classes)
+
+ cp_var = ENV['CLASSPATH']
+ if cp_var
+ ENV['CLASSPATH'] += File::PATH_SEPARATOR
+ else
+ ENV['CLASSPATH'] = ''
+ end
+ ENV['CLASSPATH'] += cp
+
+ trace "Running jirb using JRUBY_HOME: #{jruby_home}"
+ system(File.expand_path('bin/jirb' + SUFFIX, jruby_home))
+ else
+ cp = project.compile.dependencies + [
+ "org.jruby:jruby-complete:jar:#{JRUBY_VERSION}",
+ project.path_to(:target, :classes)
+ ]
+
+ Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
+ :properties => rebel_props(project),
+ :classpath => cp,
+ :java_args => rebel_args
+ }
+ end
end
-
private
def jruby_home
@home ||= ENV['JRUBY_HOME']