Skip to content

Instantly share code, notes, and snippets.

@robinboening
Last active December 25, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinboening/7059763 to your computer and use it in GitHub Desktop.
Save robinboening/7059763 to your computer and use it in GitHub Desktop.
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