lib/appengine-tools/appcfg.rb in appengine-tools-0.0.6 vs lib/appengine-tools/appcfg.rb in appengine-tools-0.0.7
- old
+ new
@@ -23,50 +23,49 @@
module AppEngine
module Admin
if defined? Java
AppCfg = AppEngine::SDK.load_appcfg
import Java.ComGoogleAppengineToolsAdmin.AppAdminFactory
- import Java.ComGoogleAppengineToolsAdmin.AppVersionUpload
import Java.ComGoogleAppengineToolsUtil.Logging
- class JRubyAppVersionUpload < AppVersionUpload
- def initialize(connection, app)
- @connection = connection
- @app = app
- super(connection, app)
- end
-
- def getIndexYaml
- indexes = merge_indexes
+ $CLASSPATH << File.dirname(__FILE__)
+ import Java.ComGoogleAppengineJruby.AppVersionUploadDelegate
+ import Java.ComGoogleAppengineJruby.JRubyAppVersionUpload
+
+ class UploadDelegate
+ include AppVersionUploadDelegate
+
+ def index_yaml(app)
+ indexes = merge_indexes(app)
if indexes
return indexes.to_yaml
end
- nil
+ ''
end
- def getCronYaml
+ def cron_yaml(app)
cron = File.join(app.path, 'cron.yaml')
if File.exists?(cron)
return IO.read(cron)
end
- nil
+ ''
end
- def getQueueYaml
+ def queue_yaml(app)
queue = File.join(app.path, 'queue.yaml')
if File.exists?(queue)
return IO.read(queue)
end
- nil
+ ''
end
- def merge_indexes
- if @app.indexes_xml
- indexes = YAML.load(@app.indexes_xml.to_yaml)['indexes']
+ def merge_indexes(app)
+ if app.indexes_xml
+ indexes = YAML.load(app.indexes_xml.to_yaml)['indexes']
end
indexes ||= []
- index_yaml = File.join(@app.path, 'index.yaml')
+ index_yaml = File.join(app.path, 'index.yaml')
if File.exist?(index_yaml)
manual_indexes = YAML.load_file(index_yaml)['indexes'] || []
manual_indexes.each do |index|
indexes << index unless indexes.include?(index)
end
@@ -107,11 +106,12 @@
puts "=> Running AppCfg"
run_appcfg(args)
end
def run_appcfg(args)
+ JRubyAppVersionUpload.set_delegate(UploadDelegate.new)
factory = AppAdminFactory.new
- factory.setAppVersionUploadClass(JRubyAppVersionUpload)
+ factory.setAppVersionUploadClass(JRubyAppVersionUpload.java_class)
Logging.initializeLogging
AppCfg.new(factory, args.to_java(java.lang.String))
end
def bundle(*args)