Capistrano: Set Subversion User at Deployment

Posted by OrganicVeggie Thu, 02 Aug 2007 11:20:00 GMT

When deploying a Rails application using Capistrano, I discovered I needed a way to specify the username and password for Subversion and I didn't want to hardcode this information. I found an excellent suggestion on Jonathan.inspect:

Capistrano tips

I didn't follow his advice exactly, but I ended up with something fairly close that I added to my deploy.rb script:

# Setup prompts for Subversion username/password
set :svn_user, ENV['svn_user'] if ! ENV['svn_user'].nil?
set :svn_user, Proc.new { Capistrano::CLI.password.prompt("SVN user: ") } if ENV['svn_user'].nil?
set :svn_password, Proc.new { Capistrano::CLI.password.prompt("SVN password for '#{svn_user}': ") }
set :repository,
Proc.new { "--username #{svn_user} " +
"--password #{svn_password} " +
"http://myserver/mypath" }

That allows me to specify both the username and password at run time. Very handy!

Posted in  | Tags , , , ,  | no comments

Comments

(leave url/email »)

   Comment Markup Help Preview comment