Class: Buildr::Shell::JIRB
- Includes:
- JRebel
- Defined in:
- lib/buildr/core/shell.rb
Constant Summary collapse
- JRUBY_VERSION =
'1.4.0'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from JRebel
#jrebel_args, #jrebel_home, #jrebel_props, #rebel_jar
Methods inherited from Base
Constructor Details
This class inherits a constructor from Buildr::Shell::Base
Instance Method Details
#launch(task) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/buildr/core/shell.rb', line 61 def launch(task) if jruby_home # if JRuby is installed, use it cp = project.compile.dependencies + [project.path_to(:target, :classes)] + Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar") + task.classpath props = { 'jruby.home' => jruby_home, 'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib" } props.merge! jrebel_props(project) props.merge! task.properties if not Util.win_os? uname = `uname -m` cpu = if uname =~ /i[34567]86/ 'i386' elsif uname == 'i86pc' 'x86' elsif uname =~ /amd64|x86_64/ 'amd64' end os = `uname -s | tr '[A-Z]' '[a-z]'` path = if os == 'darwin' 'darwin' else "#{os}-#{cpu}" end props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}" end props['jruby.script'] = if Util.win_os? then 'jruby.bat' else 'jruby' end props['jruby.shell'] = if Util.win_os? then 'cmd.exe' else '/bin/sh' end args = [ "-Xbootclasspath/a:#{Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}jruby*.jar").join File::PATH_SEPARATOR}" ] + jrebel_args + task.java_args Java::Commands.java 'org.jruby.Main', "#{jruby_home}#{File::SEPARATOR}bin#{File::SEPARATOR}jirb", { :properties => props, :classpath => cp, :java_args => args } else cp = project.compile.dependencies + [ jruby_artifact, project.path_to(:target, :classes) ] + task.classpath props = jrebel_props(project).merge(task.properties) args = jrebel_args + task.java_args Java::Commands.java 'org.jruby.Main', '--command', 'irb', { :properties => props, :classpath => cp, :java_args => args } end end |