Created
November 22, 2010 15:32
-
-
Save lest/710117 to your computer and use it in GitHub Desktop.
Place this to your Capfile
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
server 'server.host.or.ip.address', :app | |
set :user, 'user' | |
set :deploy_to, '/path/to/deploy' | |
set :repository, 'git repository address' | |
set :branch, 'origin/master' | |
namespace :deploy do | |
desc 'Deploy' | |
task :default do | |
update | |
restart | |
end | |
desc 'Setup' | |
task :setup do | |
run "mkdir -p #{deploy_to} && git clone #{repository} #{deploy_to}" | |
end | |
desc 'Update' | |
task :update do | |
update_code | |
end | |
desc 'Update the deployed code' | |
task :update_code do | |
run "cd #{deploy_to} && git fetch origin && git reset --hard #{branch}" | |
end | |
desc 'Restart' | |
task :restart do | |
run "mkdir -p #{deploy_to}/tmp && touch #{deploy_to}/tmp/restart.txt" | |
end | |
desc 'Show pending commits' | |
task :pending do | |
current_revision = capture("cd #{deploy_to} && git rev-parse HEAD").chomp | |
system("git log #{current_revision}..#{branch}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment