You can use Capistrano::CLI::ask in a early task to ask for such
credentials, here's something from my app which I use to ask the user for
the branch name, with a sensible default, this is shared between :
set :branch, lambda do
a = Capistrano::CLI.password_prompt("SHA1/Branch/Tag to deploy [#{`git
describe --abbr=0`.strip}]: ");
if a.empty?
`git describe --abbr=0`.strip
else
a
end
end
This is written out the longhand way, but you probably could compress it
into one line, that's another alternative for you, nice side-effect of this
being a lambda, is that the prompt isn't displayed until you try to use the
variable, so tasks which don't need to answer all prompts won't have to.
Another side effect of this though, is that you'll want to make sure you're
not using the variable for the first time inside one of your own run()
commands, otherwise you risk being prompted once for each server. For
things like passwords/etc used internally, this is no problem.
- Lee
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en