Forum: Rails deployment :application variable not staying set

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
48c8c4dc28c91abee54a60c32eef3fe3?d=identicon&s=25 paulnva (Guest)
on 2007-07-13 00:02
(Received via mailing list)
In trying to setup staging of various environments, I am having a
problem setting the variables when other tasks are called.

In deploy.rb I have:

# for safety, set to development in case env is not set.
set :rails_env, "development"
set :application, "development"

desc "setup test settings"
task :test do
  set :rails_env, "test"  # override :staging default
  set :application, "test"

task :show do
        puts "env = #{rails_env}"
        puts "application = #{application}"

when I run cap test update_code I get the following:
  * executing task test
  * executing task show
env = test
application = test
  * executing task update_code
  * querying latest revision...
  * executing "if [[ ! -d /u/apps/development/releases/
20070712213744 ]]; then\n              svn co --no-auth-cache   -q -
r460 blah blah

env and application are set, but the application directory is still /

Is there a scope problem? is there an operator problem? This has me
snowed! I know the answer is simple.

Thanks for help or a link for the solution..
48c8c4dc28c91abee54a60c32eef3fe3?d=identicon&s=25 paulnva (Guest)
on 2007-07-17 11:48
(Received via mailing list)
Just in case someone is reading this, I got an answer on another forum
and wanted to put here for completeness. and I dont' know how to cross
post this .

from Brian Smith
"Try explicitly setting
the :deploy_to variable to lazily evaluate (lambda)... i.e.

set(:deploy_to) { "/u/apps/#{application}" }

I think the problem is that :deploy_to is being set based
on :application BEFORE the task :test is being run. "

That seemed to do the trick!
This topic is locked and can not be replied to.