Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano multistage variables

Tags:

capistrano

When using ext/multistage, why aren't the variables that are set in a stage (production.rb) available in deploy.rb?

In production.rb: set :domain, "domain.com"

In deploy.rb: set :vhost, "/var/www/#{domain}"

But when I try to run, it complains

undefined local variable or method `domain' for #<Capistrano::Configuration:0x00000100d07248> (NameError)
like image 376
devth Avatar asked Nov 09 '10 19:11

devth


1 Answers

This seems very silly, and I'm probably not doing this right, but it does work if I defer the variable setting in deploy.rb like this:

set(:stage_domain) { "#{domain}" }
set(:vhost) { "/var/www/#{stage_domain}" }
set(:repo_dir) { "#{vhost}/repository" }
set(:deploy_to) { "#{repo_dir}" }
set(:httpdocs_link) { "#{deploy_to}" }
role(:web) { stage_domain }
like image 171
devth Avatar answered Nov 17 '22 03:11

devth