Created
August 21, 2013 14:15
-
-
Save michiels/6295011 to your computer and use it in GitHub Desktop.
Don't allow someone to deploy a feature branch when there's already one active
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
| if ENV['BRANCH'] | |
| before "deploy", "deploy:check_branch" | |
| end | |
| after "deploy:finalize_update", "deploy:put_branch" | |
| namespace :deploy do | |
| task :check_branch do | |
| current_branch = capture("cat #{current_path}/BRANCH; true") | |
| if branch != 'master' && current_branch != 'master' && current_branch != `git rev-parse --abbrev-rev HEAD` | |
| puts 'Sorry, someone else is already deploying a feature branch.' | |
| exit | |
| end | |
| end | |
| task :put_branch do | |
| put "#{branch}", "#{release_path}/BRANCH" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment