Created
January 16, 2009 20:10
-
-
Save eschulte/48095 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def confirm_intent(prompt, answer) | |
puts prompt | |
users_answer = Capistrano::CLI.ui.ask("(type #{answer} to continue)? ") { |p| p.echo == true } | |
abort unless users_answer == answer | |
end | |
task :staging do | |
confirm_intent("Are you SURE you want to deploy to the staging server? ", "YES") | |
role :app, "1.2.3.4" | |
role :web, "1.2.3.4" | |
role :db, "1.2.3.4", :primary => true | |
set :rails_env, "production" | |
@database = { | |
'production' => { | |
'adapter' => 'mysql', | |
'database' => 'production', | |
'username' => 'root', | |
# replace the password with prompting function if we don't want passwords saved in text files | |
'password' => 'password'}} | |
@mongrel_cluster = { | |
'prefix' => '/#{application}', | |
'cwd' => '/var/www/#{application}/current/', | |
'log_file' => 'log/mongrel.log', | |
'port' => '3000', | |
'environment' => 'production', | |
'address' => '127.0.0.1', | |
'pid_file' => 'tmp/pids/mongrel.pid', | |
'servers' => 3} | |
end | |
task :development do | |
role :app, "5.6.7.8" | |
role :web, "5.6.7.8" | |
role :db, "5.6.7.8", :primary => true | |
set :rails_env, "development" | |
@database = { | |
'development' => { | |
'adapter' => 'mysql', | |
'database' => 'development', | |
'username' => 'root', | |
# replace the password with prompting function if we don't want passwords saved in text files | |
'password' => 'password'}} | |
@mongrel_cluster = { | |
'prefix' => '/#{application}', | |
'cwd' => '/var/www/#{application}/current/', | |
'log_file' => 'log/mongrel.log', | |
'port' => '3000', | |
'environment' => 'production', | |
'address' => '127.0.0.1', | |
'pid_file' => 'tmp/pids/mongrel.pid', | |
'servers' => 3} | |
end | |
desc "hook run after the code is updated" | |
task :after_update_code, :roles => [:web, :app, :db] do | |
# create the database.yml file defined in the machine-specific code blocks earlier | |
put(YAML::dump(@database), "#{release_path}/config/database.yml", :mode => 0664) | |
# create the mongrel_cluster.yml file defined in the machine-specific code blocks earlier | |
put(YAML::dump(@mongrel_cluster), "#{release_path}/config/mongrel_cluster.yml", :mode => 0664) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment