Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Capistrano::Configuration.instance(:must_exist).load do |c|
- #===================================================================
- # These variables must be set, otherwise cap will fail
- #===================================================================
- set(:db_user) { abort 'Please configure the db_user variable before deploying.' }
- set(:db_pass) { abort 'Please configure the db_pass variable before deploying.' }
- #===================================================================
- # You may need to override these variables
- #===================================================================
- set(:db_name) { application }
- set(:db_host, "localhost")
- set(:db_adapter, "mysql")
- namespace :swig505 do
- namespace :db do
- desc <<-DESC
- Setup the database.yml file in shared/config
- DESC
- task :setup_config, :roles => :app do
- database_configuration = <<-EOF
- #{rails_env}:
- adapter: #{db_adapter}
- host: #{db_host}
- username: #{db_user}
- password: #{db_pass}
- database: #{db_name}
- EOF
- run "mkdir -p #{shared_path}/config"
- put database_configuration, "#{shared_path}/config/database.yml"
- end
- desc <<-DESC
- Link the database.yml config from release_path to shared/config
- DESC
- task :link_config, :roles => :app do
- run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
- end
- end
- end
- after "deploy:setup", "swig505:db:setup_config"
- after "deploy:symlink", "swig505:db:link_config"
- end
Add Comment
Please, Sign In to add comment