Hi Rafael. Thanks, your suggestions wasn't quite right, but you pointed me in the right direction, and some more googling and I got it going.
set(:user) do Capistrano::CLI.ui.ask "Give me a ssh user: " end It seems the :user variable is a special variable, the one I was looking for! My impression is that Capistrano 2.0 is a major change from 1.x series, but are all the reserved variables the same between the two versions? I noticed some other threads about trying to document 2.0 better. I'd buy that book. :-) Thanks a bunch Todd On Fri, 2007-12-14 at 00:02 +0100, Rafael G. wrote: > Before was incorrect.Sorry! > > set(:username) do > Capistrano::CLI.ui.ask "Give me a ssh user: " > end > > I think it's ok. > Regards. > > Rafael G. escribió: > > 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 > >> > >> >> > >> > >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
