Sha256: 4374845776e9c50a7211c60606e73b508bc68dc2550a54e8405d8b33182f14ad

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents


module Redcar
  
  # Cribbed from ruby-processing. Many thanks!
  class Runner
    
    # Trade in this Ruby instance for a JRuby instance, loading in a 
    # starter script and passing it some arguments.
    # If --jruby is passed, use the installed version of jruby, instead of 
    # our vendored jarred one (useful for gems).
    def spin_up
      bin = "#{File.dirname(__FILE__)}/../../bin/redcar"
      jruby_complete = Dir[File.dirname(__FILE__) + "/../jruby-complete-1.4.0.jar"].first
      args = []
      if false
        command = "jruby #{java_args} \"#{bin}\" #{ARGV.join(' ')}"
      else
        command = "java #{java_args} -cp \"#{jruby_complete}\" org.jruby.Main \"#{bin}\" #{ARGV.join(' ')}"
      end
      exec(command)
    end
    
    def java_args
      if Config::CONFIG["host_os"] =~ /darwin/
        "-XstartOnFirstThread"
      else
        ""
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcar-0.3.1dev lib/redcar/runner.rb
redcar-0.3.0dev lib/redcar/runner.rb