Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
desc "Prompt for branch or tag"
task git_branch_or_tag: :'git:wrapper' do
on roles(:all) do |host|
tags = "<none>"
within repo_path do
with fetch(:git_environmental_variables) do
tags = capture(:git, :tag).split.join(', ')
end
end
run_locally do
tag_prompt = "Enter a branch or tag name to deploy, available tags include #{tags}"
ask(:branch_or_tag, tag_prompt)
tag_branch_target = fetch(:branch_or_tag)
execute "echo \"About to deploy branch or tag '#{tag_branch_target}'\""
set(:branch, tag_branch_target)
end
end
end
before 'deploy:starting', :git_branch_or_tag
Looks good Dave!
Sent from my Nexus 4.
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/7b0c649f-5e89-41c0-87f2-edf9559b612f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
def tag_branch_target
tags = `git tag`.split("\n")
tag_prompt = "\nlast tags available are #{tags.reverse[(0..5)]}"
ask :branch_or_tag, tag_prompt
tag = fetch(:branch_or_tag)
tag.match(/^\d/).nil? ? tags.last : tag
end
set :branch, proc { tag_branch_target }NFO[edfd8380] Running /usr/bin/env chmod +x /tmp/ace/git-ssh.sh on 10.10.82.31
DEBUG[edfd8380] Command: /usr/bin/env chmod +x /tmp/ace/git-ssh.sh
INFO[6d1eea4e] Finished in 0.168 seconds with exit status 0 (successful).
INFO[edfd8380] Finished in 0.164 seconds with exit status 0 (successful).
Please enter branch_or_tag (
last tags available are ["0.9.1", "0.9.0", "0.8.0", "0.7.9", "0.7.8", "0.7.7"]):