Last active
December 25, 2015 23:49
-
-
Save robinboening/7059763 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
def ask_for_tag | |
default_tag = `git tag`.split("\n").last | |
if default_tag == nil | |
puts "Please make sure you have pushed at least one tag. (git push origin --tags)" | |
exit! | |
else | |
tag = Capistrano::CLI.ui.ask "Tag to deploy (make sure to push the tag first): [#{default_tag}] " | |
tag = default_tag if tag.empty? | |
tag | |
end | |
end | |
namespace :deploy do | |
desc "Update the deployed code." | |
task :update_code, :except => { :no_release => true } do | |
run "cd #{current_path}; git fetch origin; git reset --hard #{branch}" | |
finalize_update | |
end | |
end | |
set(:branch) { ask_for_tag } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment