Created
July 13, 2013 07:31
-
-
Save almaron/5989804 to your computer and use it in GitHub Desktop.
Deploy.rb
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
namespace :deploy do | |
task :start do end | |
task :stop do end | |
task :restart, roles: :app, except: {no_release: true} do | |
run "touch #{deploy_to}/current/tmp/restart.txt" | |
end | |
task :setup_config, roles: :app do | |
run "mkdir -p #{shared_path}/config" | |
put File.read("config/database.yml"), "#{shared_path}/config/database.yml" | |
puts "Now edit the config files in #{shared_path}." | |
end | |
after "deploy:setup", "deploy:setup_config" | |
task :symlink_config, roles: :app do | |
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" | |
end | |
after "deploy:finalize_update", "deploy:symlink_config" | |
task :upload_link do | |
run "rm -rf #{release_path}/public/uploads" | |
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads" | |
end | |
after "deploy", "deploy:upload_link" | |
after "deploy", "deploy:migrate" | |
desc "Make sure local git is in sync with remote." | |
task :check_revision, roles: :web do | |
unless `git rev-parse HEAD` == `git rev-parse origin/master` | |
puts "WARNING: HEAD is not the same as origin/master" | |
puts "Run `git push` to sync changes." | |
exit | |
end | |
end | |
before "deploy", "deploy:check_revision" | |
set :whenever_command, "bundle exec whenever" | |
require "whenever/capistrano" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment