Module: AppEngine::SDK

Defined in:
lib/appengine-sdk.rb

Constant Summary collapse

VERSION =
'1.6.2.1'
SDK_ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..',
'appengine-java-sdk-1.6.2.1'))
TOOLS_JAR =
File.join(SDK_ROOT, *%w{lib appengine-tools-api.jar})
API_JAR =
File.join(SDK_ROOT, *%w{lib impl appengine-api.jar})
LABS_JAR =
File.join(SDK_ROOT, *%w{lib impl appengine-api-labs.jar})
AGENT_JAR =
File.join(SDK_ROOT, *%w{lib agent appengine-agent.jar})
RUNTIME_JARS =
File.join(SDK_ROOT, *%w{lib shared appengine-local-runtime-shared.jar}),
File.join(SDK_ROOT, *%w{lib impl appengine-api-stubs.jar}),
File.join(SDK_ROOT, *%w{lib impl appengine-local-runtime.jar}),
File.join(SDK_ROOT, *%w{lib testing appengine-testing.jar})

Class Method Summary collapse

Class Method Details

.load_apiproxyObject

Tries to load the ApiProxy class.



37
38
39
40
41
# File 'lib/appengine-sdk.rb', line 37

def load_apiproxy
  with_jars(API_JAR) do
    return Java.ComGoogleApphostingApi.ApiProxy
  end
end

.load_appcfgObject



69
70
71
72
73
# File 'lib/appengine-sdk.rb', line 69

def load_appcfg
  with_jars(TOOLS_JAR) do
    return Java.ComGoogleAppengineToolsAdmin.AppCfg
  end
end

.load_kickstartObject

Tries to load the Kickstart class.



59
60
61
62
63
64
65
66
67
# File 'lib/appengine-sdk.rb', line 59

def load_kickstart
  cp = java.lang.System.get_property('java.class.path')
  sep = java.io.File::pathSeparator
  java.lang.System.set_property('java.class.path',
                                "#{TOOLS_JAR}#{sep}#{cp}")
  with_jars(TOOLS_JAR) do
    return Java.ComGoogleAppengineTools.KickStart
  end
end

.load_labsObject



43
44
45
46
47
# File 'lib/appengine-sdk.rb', line 43

def load_labs
  with_jars(LABS_JAR) do
    return Java.ComGoogleAppengineApiLabsTaskqueue.QueueFactory
  end
end

.load_local_test_helperObject

Tries to load the LocalServiceTestHelper class.



50
51
52
53
54
55
56
# File 'lib/appengine-sdk.rb', line 50

def load_local_test_helper
  load_apiproxy
  load_labs
  with_jars(*RUNTIME_JARS) do
    return Java.ComGoogleAppengineToolsDevelopmentTesting.LocalServiceTestHelper
  end
end

.sdk_path(*pieces) ⇒ Object

Tries to find the Google App Engine SDK for Java.

Looks for appcfg.sh in these directories (in order):

  • ENV/bin

  • each directory in ENV

  • ‘/usr/local/appengine-java-sdk/bin’

  • ‘c:appengine-java-sdkbin’

Returns File.join(sdk_directory, *pieces)



102
103
104
# File 'lib/appengine-sdk.rb', line 102

def sdk_path(*pieces)
  File.join(SDK_ROOT, *pieces)
end

.with_jars(*jars) ⇒ Object

:nodoc:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/appengine-sdk.rb', line 75

def with_jars(*jars)  # :nodoc:
  failed = false
  begin
    yield
  rescue NameError => ex
    if failed
      raise ex
    else
      failed = true
      jars.each do |jar|
        $CLASSPATH << jar
      end
      retry
    end
  end
end