Skip to content

Commit

Permalink
Add git "oops" protection to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Gunderloy authored and Mike Gunderloy committed Sep 5, 2009
1 parent 37d9b4d commit 850a175
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lark_template.rb
Expand Up @@ -735,12 +735,14 @@ def role_only(rolename, &block)
set :repository, "git@#{capistrano_repo_host}:#{current_app_name}.git"
set :user, "#{capistrano_user}"
set :deploy_via, :fast_remote_cache
set :copy_exclude, %w(.git doc test)
set :scm, :git
# Customise the deployment
set :tag_on_deploy, false # turn off deployment tagging, we have our own tagging strategy
set :keep_releases, 6
before "deploy", "deploy:check_revision"
after "deploy:update", "deploy:cleanup"
# directories to preserve between deployments
Expand All @@ -754,6 +756,20 @@ def role_only(rolename, &block)
# end
# end
namespace :deploy do
desc "Make sure there is something to deploy"
task :check_revision, :roles => [:web] do
unless `git rev-parse HEAD` == `git rev-parse origin/\#{branch}`
puts ""
puts " \033[1;33m**************************************************\033[0m"
puts " \033[1;33m* WARNING: HEAD is not the same as origin/\#{branch} *\033[0m"
puts " \033[1;33m**************************************************\033[0m"
puts ""
exit
end
end
end
END

file 'config/deploy/production.rb', <<-END
Expand Down

0 comments on commit 850a175

Please sign in to comment.