Module: AppEngine::Development

Defined in:
lib/appengine-tools/boot.rb,
lib/appengine-tools/dev_appserver.rb

Defined Under Namespace

Classes: JRubyDevAppserver

Constant Summary collapse

BOOT_APP_RB =
File.join(File.dirname(__FILE__), 'boot_app.rb')
DEV_APPSERVER =
['com.google.appengine.tools.development.DevAppServerMain']

Class Method Summary collapse

Class Method Details

.boot_app(root, args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/appengine-tools/boot.rb', line 25

def boot_app(root, args)
  root = File.expand_path(root)

  jars = AppEngine::SDK::RUNTIME_JARS

  jruby_args = ["-r#{BOOT_APP_RB}"] + args

  ENV['APPLICATION_ROOT'] = root
  ENV.delete 'GEM_HOME'
  exec_jruby(root, jars, jruby_args)
end

.build_command(root, jars, args) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/appengine-tools/boot.rb', line 37

def build_command(root, jars, args)
  app_jars = root ? Dir.glob("#{root}/WEB-INF/lib/*.jar") : []
  classpath = (app_jars + jars).join(File::PATH_SEPARATOR)
  utf = "-Dfile.encoding=UTF-8"
  command = %W(java #{utf} -cp #{classpath} org.jruby.Main) + args
  if ENV['VERBOSE']
    puts command.map {|a| a.inspect}.join(' ')
  end
  command
end

.exec_jruby(root, jars, args) ⇒ Object



48
49
50
51
# File 'lib/appengine-tools/boot.rb', line 48

def exec_jruby(root, jars, args)
  java_command = build_command(root, jars, args)
  exec *java_command
end