Skip to content

Instantly share code, notes, and snippets.

@benatkin
Created August 22, 2010 03:18
Show Gist options
  • Save benatkin/543235 to your computer and use it in GitHub Desktop.
Save benatkin/543235 to your computer and use it in GitHub Desktop.
# A partial port of http://geewax.org/introducing-appmake to Rake
PYTHON = "python"
APPENGINE = "/usr/local/google_appengine"
APP_ID = "" # replace with your app id
EMAIL = "" # replace with your email address
SERVE_PORT = 9091
SERVE_ADDRESS = "0.0.0.0"
DATASTORE_PATH = "./datastore"
desc "Runs the test suite"
task :test do |dir|
system "nosetests --with-gae --with-isolation #{dir}"
end
desc "Runs the test suite and prints a coverage report"
task :coverage do |dir|
system "nosetests --with-gae --with-isolation --with-coverage #{dir}"
end
desc "Deploys the current project to AppEngine"
task :deploy do
system "#{PYTHON} #{APPENGINE}/appcfg.py -e #{EMAIL} update ."
end
desc "Rolls back a unclosed update to the application"
task :rollback do
system "#{PYTHON} #{APPENGINE}/appcfg.py -e #{EMAIL} rollback ."
end
desc "Runs the development web server"
task :serve do
system "#{PYTHON} #{APPENGINE}/dev_appserver.py " +
"-a #{SERVE_ADDRESS} " +
"-p #{SERVE_PORT} " +
"--datastore_path=#{DATASTORE_PATH} " +
"--disable_static_caching " +
"."
end
desc "Opens a development console to your remote application (Only works if you've enabled the /remote_api URL)"
task :console do
system "#{PYTHON} -c \"import code, getpass; " +
"from google.appengine.ext.remote_api import remote_api_stub; " +
"auth = lambda: ('#{EMAIL}', getpass.getpass('Password: ')); " +
"remote_api_stub.ConfigureRemoteDatastore('#{APP_ID}', '/remote_api', auth, '#{APP_ID}.appspot.com'); " +
"code.interact('App Engine console for #{APP_ID}', None, locals());\""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment