lib/appengine-tools/appcfg.rb in appengine-tools-0.0.7 vs lib/appengine-tools/appcfg.rb in appengine-tools-0.0.8.pre

- old
+ new

@@ -79,11 +79,11 @@ end end class JRubyAppCfg NO_XML_COMMANDS = %w{version} - RUBY_COMMANDS = %w{gem bundle help run} + RUBY_COMMANDS = %w{gem bundle help run generate_app} COMMAND_SUMMARY = <<EOF run: run jruby in your application environment. bundle: package your application for deployment. The 'run' command assumes the app directory is the current directory. EOF @@ -112,18 +112,40 @@ factory = AppAdminFactory.new factory.setAppVersionUploadClass(JRubyAppVersionUpload.java_class) Logging.initializeLogging AppCfg.new(factory, args.to_java(java.lang.String)) end - + + def generate_app(*args) + if args and args.size > 0 + appdir = args.pop + webinf = File.join(appdir, 'WEB-INF') + FileUtils.mkdir_p(webinf) + AppEngine::Admin.bundle_app(appdir) + else + generate_app_help + end + end + + def generate_app_help + help = <<EOF +#{$0} generate_app app_dir + +Generates a sample Rack application in app_dir. +The directory is created if it doesn't exist. + +EOF + puts help + end + def bundle(*args) if File.directory?(args[-1] || '') AppEngine::Admin.bundle_app(*args) else bundle_help end end - + def bundle_help help = <<EOF #{$0} bundle [gem bundle options] app_dir Bundles the gems listed in Gemfile and generates files necessary