Skip to content

Instantly share code, notes, and snippets.

@jhchabran
Created September 6, 2009 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhchabran/181784 to your computer and use it in GitHub Desktop.
Save jhchabran/181784 to your computer and use it in GitHub Desktop.
# 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