views:

20

answers:

1

I've set up Capistrano to ask me which git tag I want to deploy:

# deploy.rb
set(:branch) { Capistrano::CLI.ui.ask('Tag to deploy:') }

This works as expected - if I specify v0.75 it will deploy that tag.

However, I'd love it if I could print out the list of my tags before I get asked which one to deploy, with something like this:

git tag -n | tac | head -n 10

How can I execute and print the result of the above shell command in capistrano, before being prompted for the tag to deploy?

+1  A: 

Turns out that there's no magic required. The following will do it nicely:

set :branch do
  puts `git tag -n | tac | head -n 10`
  Capistrano::CLI.ui.ask('Tag to deploy:')
end
nfm