Created
September 6, 2009 12:17
-
-
Save jhchabran/181784 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
# When deploying for the first time, use vlad:install before vlad:deploy | |
# 1) vlad:install will copy all files matching .sample* in deploy_to/shared/config | |
# 2) edit those files and rename them to their final name | |
# 3) each time you deploy with vlad:deploy, your config files will be symlinked in your application config folder | |
namespace :vlad do | |
def shared_config_path | |
shared_path + '/' + 'config' | |
end | |
desc "Showtime! pull from git then (re)start the app servers" | |
task :deploy => [:update, :symlink_configuration, :migrate, :start_app] | |
desc "Symlink config files to newly deployed app" | |
remote_task :symlink_configuration, :roles => :app do | |
run <<-SHELL | |
cd #{shared_config_path} | |
for f in * | |
do | |
if [ -e #{current_path}/config/$f ] | |
then | |
rm #{current_path}/config/$f | |
fi | |
ln -s $PWD/$f #{current_path}/config/$f | |
done | |
SHELL | |
end | |
desc "Setup local configuration directory" | |
remote_task :setup_configuration, :roles => :app do | |
run "if [ ! -d #{shared_config_path} ]; then mkdir #{shared_config_path}; fi;" | |
run "cp #{current_path}/config/*.sample* #{shared_config_path}" | |
puts "You may now edit ( and remove sample suffix ) files in #{shared_config_path}/ to configure your application." | |
end | |
desc "Setup and prepare config files" | |
task :install => [:setup, :update, :setup_configuration] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment