Skip to content

Instantly share code, notes, and snippets.

@takeru
Created February 23, 2010 14:56
Show Gist options
  • Select an option

  • Save takeru/312251 to your computer and use it in GitHub Desktop.

Select an option

Save takeru/312251 to your computer and use it in GitHub Desktop.
rack_opts = {
:precompilation_enabled => true
}
case ENV["DEPLOY_APPID"]
when "app-production", "app-staging", "app-test01", "app-test02"
ver = ENV["DEPLOY_VERSION"]
raise "DEPLOY_VERSION is blank" if ver.nil? || ver.empty?
rack_opts[:application] = ENV["DEPLOY_APPID"]
rack_opts[:version ] = ver
when nil
case ENV['USER']
when "takeru"
rack_opts[:application] = 'app-takeru'
rack_opts[:version ] = '001'
when "john"
rack_opts[:application] = 'app-john'
rack_opts[:version ] = '002'
else
# raise "unknown ENV['USER']=#{ENV['USER']}"
# It's GAE Runtime..
end
else
raise "unknown DEPLOY_APPID=#{ENV['DEPLOY_APPID']}"
end
AppEngine::Rack.configure_app(rack_opts)
...
#!/usr/bin/env ruby
unless File.exist?("Gemfile") && File.exist?("config.ru")
puts "Gemfile or config.ru is not exist. #{Dir.pwd}"
exit
end
app_id = ARGV[0]
app_ver = ARGV[1]
if app_id.nil? || app_ver.nil?
puts "usage: ruby script/deploy.rb APPID VERSION"
exit
end
system("rm -f WEB-INF/appengine-web.xml; DEPLOY_APPID=#{app_id} DEPLOY_VERSION=#{app_ver} appcfg.rb update .")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment