Hi, try with it: set(:ssh_username) do Capistrano::CLI.ui.ask "Give me a ssh user: " end
Regards TravellingGuy escribió: > We're just getting into the world of capistrano to deploy websites. > Thanks to the excellent getting started docs at capify.org, I was able > to jump right in and create some fairly sophisticated deployment > scripts. > > I'm using capistrano 2.1 and have no experience with previous > versions. > > One thing that I would like to do is have cap ask for the username to > use when ssh'ing to the server to run tasks. This would allow any of > our developers to deploy using their own login. Note that the USER/ > USERNAME environment variables won't work, because there's no > guarantee that the users remote login will be the same as their > username on their local machine. > > I've tried this: > # Export from svn to test.gon.com > desc "Update dev environment from SVN" > task :deploy_to_dev, :hosts => "[EMAIL PROTECTED]" do > ......do stuff > end > > # Get user's ssh username > set(:ssh_username) do > print "What is your ssh username? " > STDOUT.flush > STDIN.gets.chomp > end > > However, doing a "cap --tasks" results in an error: > undefined local variable or method ssh_`username' > > So, I moved the set(:ssh_username)....above the task: > # Get user's ssh username > set(:ssh_username) do > print "What is your ssh username? " > STDOUT.flush > STDIN.gets.chomp > end > > # Export from svn to test.gon.com > desc "Update dev environment from SVN" > task :deploy_to_dev, :hosts => "[EMAIL PROTECTED]" do > ......do stuff > end > > While this works, it has a side effect of asking for the users > username even when just doing a "cap --tasks". > > Any ideas on other ways this could be accomplished? > > Thanks > > > > > -- Rafael Garcia Ortega --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
begin:vcard fn;quoted-printable:Rafael Garc=C3=ADa Ortega n;quoted-printable:Garc=C3=ADa Ortega;Rafael org:ASPgems S.L. email;internet:[EMAIL PROTECTED] tel;work:692686533 x-mozilla-html:FALSE url:http://www.aspgems.com version:2.1 end:vcard
