Created
December 21, 2009 23:42
-
-
Save jsierles/261362 to your computer and use it in GitHub Desktop.
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
| set :user, "jsierles" | |
| set :application, "loflamenco" | |
| set :repository, "git@github.com:jsierles/loflamenco.git" | |
| set :deploy_type, 'deploy' | |
| set :branch, 'origin/master' | |
| role :app, "jsierles@calx.es" | |
| namespace :deploy do | |
| desc "Deploy it" | |
| task :default do | |
| update_code | |
| gems.bundle | |
| link.assets | |
| restart | |
| end | |
| desc "Setup a GitHub-style deployment." | |
| task :setup, :except => { :no_release => true } do | |
| run "git clone #{repository} #{current_path}" | |
| end | |
| desc "Update the deployed code." | |
| task :update_code, :except => { :no_release => true } do | |
| run "cd #{current_path}; git fetch origin; git reset --hard #{branch}; git tag '#{Time.now.to_i}-#{deploy_type}'" | |
| end | |
| desc "List deployment tags for use with deploy:rollback TAG=" | |
| task :list_tags, :except => { :no_release => true } do | |
| run "cd #{current_path}; git tag -l '*-deploy' -n 3" | |
| end | |
| begin | |
| namespace :rollback do | |
| desc "Rollback a single commit." | |
| task :default, :except => { :no_release => true } do | |
| branch = ENV['TAG'] || capture("cd #{current_path}; git tag -l '*-deploy' | tail -n2 | head -n1") | |
| set :deploy_type, 'rollback' | |
| set :branch, branch | |
| deploy.default | |
| end | |
| end | |
| rescue ArgumentError | |
| desc "Rollback a single commit." | |
| task :rollback, :except => { :no_release => true } do | |
| branch = ENV['TAG'] || capture("cd #{current_path}; git tag -l '*-deploy' | tail -n2 | head -n1") | |
| set :deploy_type, 'rollback' | |
| set :branch, branch | |
| deploy.default | |
| end | |
| end | |
| desc "Signal Passenger to restart the application" | |
| task :restart, :roles => :app do | |
| run "mkdir -p #{current_path}/tmp && touch #{current_path}/tmp/restart.txt" | |
| end | |
| end | |
| namespace :logs do | |
| desc "Watch jobs log" | |
| task :default do | |
| sudo "tail -f #{current_path}/log/production.log" | |
| end | |
| end | |
| namespace :gems do | |
| task :bundle do | |
| run "cd #{current_path} && gem bundle" | |
| end | |
| end | |
| namespace :link do | |
| task :assets do | |
| run "ln -nfs #{shared_path}/system #{release_path}/public/system" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment