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)
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 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With