Created
July 23, 2009 15:25
-
-
Save darrenboyd/153080 to your computer and use it in GitHub Desktop.
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
namespace :deploy do | |
namespace :gate do | |
task :default do | |
if "#{stage}" == "production" | |
stg = CLI.ui.ask "Which environment are you deploying to again? " | |
unless stg == "#{stage}" | |
puts "I am not convinced, sorry." | |
exit(1) | |
end | |
end | |
end | |
task :schema do | |
migrations = `git diff --name-only #{current_revision}..#{branch} db/migrate` | |
if migrations.length > 0 | |
question = "It looks like there are pending migrations in this changeset:\n" | |
question << migrations + "\n" | |
question << "Are you sure you want to deploy without migrations (y/n)?" | |
answer = CLI.ui.ask(question) | |
unless answer =~ /^y(es)?/i | |
puts "Deploy aborted." | |
exit(-1) | |
end | |
end | |
end | |
end | |
before "deploy", "deploy:gate" | |
before 'deploy', 'deploy:gate:schema' | |
before "deploy:migrations", "deploy:gate" | |
# ... rest of deploy.rb file | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment