Skip to content

Instantly share code, notes, and snippets.

@microspino
Last active August 29, 2015 14:15
Show Gist options
  • Save microspino/1f7553d6cd7614410ab7 to your computer and use it in GitHub Desktop.
Save microspino/1f7553d6cd7614410ab7 to your computer and use it in GitHub Desktop.
safe deploy from master to live
task :ask_confirmation do
on roles(:all) do
run_locally do
puts "##########################################################".red
puts "# Are you sure you want do deploy #{fetch :branch} to #{fetch :stage}".red
puts "##########################################################".red
if fetch(:stage) == "live" && fetch(:branch) != "master"
abort "Mcfly? Anybody home? you can deploy live only from master"
end
ask :confirmation, "N"
if fetch(:confirmation).downcase != "y"
raise "Deploy aborted"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment