Sha256: 7c0a5f9570cd035e73a95687ca8aa3f3dd60c90bf1061d2a4dcce8acdd12bf85

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

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 = File.expand_path(File.join(File.dirname(__FILE__), "..", "jruby-complete-1.4.0.jar"))
      unless File.exist?(jruby_complete)
        puts "\nCan't find jruby jar at #{jruby_complete}, did you run 'redcar install' ?"
        exit 1
      end
      args = []
      if false
        command = "jruby #{java_args} \"#{bin}\" #{ARGV.join(' ')}"
      else
        ENV['RUBYOPT'] = nil # disable other native args
        command = "java #{java_args} -Xmx500m -Xss1024k -Djruby.memory.max=500m -Djruby.stack.max=1024k -cp \"#{jruby_complete}\" org.jruby.Main \"#{bin}\" #{ARGV.join(' ')} --no-sub-jruby"
      end
      puts command
      exec(command)
    end
    
    def java_args
      if Config::CONFIG["host_os"] =~ /darwin/
        "-XstartOnFirstThread"
      else
        ""
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redcar-0.3.4.3 lib/redcar/runner.rb
redcar-0.3.4.2 lib/redcar/runner.rb
redcar-0.3.4.1 lib/redcar/runner.rb
redcar-0.3.4 lib/redcar/runner.rb