Class: AppEngine::Development::JRubyDevAppserver
- Inherits:
-
Object
- Object
- AppEngine::Development::JRubyDevAppserver
- Defined in:
- lib/appengine-tools/dev_appserver.rb
Class Method Summary collapse
- .get_jruby_home(path) ⇒ Object
- .parse_argv(argv) ⇒ Object
- .run(args) ⇒ Object
- .start_java(path, java_args, server_args) ⇒ Object
Class Method Details
.get_jruby_home(path) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/appengine-tools/dev_appserver.rb', line 89 def get_jruby_home(path) return unless path Dir.chdir("#{path}/WEB-INF/lib") do jars = Dir.glob("appengine-jruby-*.jar").grep( /^appengine-jruby-\d+[.]\d+[.]\d+[.]jar$/) if !jars.empty? jar = File.(jars[0]) return "file:/#{jar}!/META-INF/jruby.home" end end return nil end |
.parse_argv(argv) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/appengine-tools/dev_appserver.rb', line 38 def parse_argv(argv) java_args = [] server_args = [] start_on_first_thread = false if RUBY_PLATFORM =~ /darwin/ || (RUBY_PLATFORM == 'java' && java.lang.System.getProperty("os.name").downcase == "mac os x") start_on_first_thread = true end argv.each do |arg| if arg =~ /^--jvm_flag=(.+)/ java_args << $1 elsif arg =~ /--startOnFirstThread=(true|false)/ start_on_first_thread = ($1 == "true") else server_args << arg end end if start_on_first_thread java_args << '-XstartOnFirstThread' end return server_args[-1], java_args, server_args end |
.run(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/appengine-tools/dev_appserver.rb', line 26 def run(args) path, java_args, server_args = parse_argv(ARGV) if path and File::directory?(path) AppEngine::Admin.bundle_app(path) updater = AppEngine::Admin::UpdateCheck.new(path) updater.nag if updater.can_nag? puts "=> Booting DevAppServer" puts "=> Press Ctrl-C to shutdown server" end start_java(path, java_args, server_args) end |
.start_java(path, java_args, server_args) ⇒ Object
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 |
# File 'lib/appengine-tools/dev_appserver.rb', line 62 def start_java(path, java_args, server_args) if path jruby_home = get_jruby_home(path) java_args << "-Djruby.home=#{jruby_home}" if jruby_home server_args[-1] = File.(path) Dir.chdir(path) end server_args.unshift '--disable_update_check' ENV.delete 'GEM_HOME' ENV.delete 'GEM_PATH' plugin_jar = File.join(File.dirname(__FILE__), 'app_yaml.jar') java_args << '-classpath' java_args << AppEngine::SDK::TOOLS_JAR java_args << '-Djava.util.logging.config.file=' + AppEngine::SDK::SDK_ROOT + '/config/sdk/logging.properties' java_args << "-Dcom.google.appengine.plugin.path=#{plugin_jar}" if defined? AppEngine::SDK::AGENT_JAR java_args << '-javaagent:' + AppEngine::SDK::AGENT_JAR end command = ['java'] + java_args + DEV_APPSERVER + server_args if ENV['VERBOSE'] puts "exec #{command.map{|x| x.inspect}.join(' ')}" end exec(*command) end |