Created
October 19, 2010 23:06
-
-
Save devth/635363 to your computer and use it in GitHub Desktop.
Git-based deployment for non-rails using Capistrano
This file contains hidden or 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 do ; end | |
| desc "Deploy the app" | |
| task :default do | |
| update | |
| end | |
| desc "Setup and clone the repo." | |
| task :setup do | |
| # setup | |
| sudo "mkdir -p #{vhost}/repository/" | |
| # permissions | |
| sudo "chown -R #{owner}:#{group} #{repo_dir}" | |
| sudo "chmod -R g+w #{repo_dir}" | |
| # clone | |
| run "git clone #{repository} #{deploy_to}" | |
| # linking | |
| sudo "rm -rf #{vhost}/httpdocs" | |
| sudo "ln -s #{httpdocs_link} #{vhost}/httpdocs" | |
| sudo "chown -R #{user}:#{group} #{vhost}/httpdocs" | |
| end | |
| desc "Update the deployed code" | |
| task :update do | |
| run "cd #{deploy_to} && git pull origin #{branch}" | |
| end | |
| desc "Rollback a single commit." | |
| task :rollback do | |
| set :branch, "HEAD^" | |
| default | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment