deploy.cap revision 2b87555cc1381f03e469c079c9cdad17b6226dfc
1281N/A
0N/Anamespace :deploy do
0N/A
0N/A desc 'Restart application'
1281N/A task :restart do
0N/A on roles(:app) do
0N/A execute :touch, release_path.join('tmp/restart.txt')
0N/A end
0N/A end
0N/A
0N/A desc "Saves the current revision to release_path/REVISION"
0N/A task :set_revision do
0N/A on roles(:app) do
0N/A # dump current git revision
0N/A rev = capture "cd #{repo_path} && git rev-parse --short #{fetch :branch}"
0N/A execute :echo, "#{rev} > #{release_path}/REVISION"
0N/A end
0N/A end
1105N/A
1186N/A desc "Moves and replaces the secret-token if missing in shared directory"
0N/A task :symlink_secret do
1186N/A on roles(:app) do
1186N/A filename = 'secret_token.rb'
1186N/A release_secret = release_path.join("config/initializers/#{filename}")
1186N/A shared_secret = shared_path.join("config/#{filename}")
1140N/A
1186N/A unless test "[ -f #{shared_secret} ]"
1186N/A within release_path do
1186N/A execute :rake, "secret:replace"
1281N/A end
1281N/A execute :mv, "#{release_secret} #{shared_secret}"
1186N/A end
1281N/A
1281N/A # symlink secret token
1281N/A execute :ln, "-nfs #{shared_secret} #{release_secret}"
1281N/A end
1281N/A end
1470N/A
1281N/A after :updated, :symlink_secret
1281N/A after :updated, :set_revision
1281N/A after :publishing, :restart
1281N/Aend
1186N/A