public
Description: Provides clean ruby syntax for defining messy cron jobs and running them Whenever.
Home | Edit | New

Automatically Detecting Environment

You can probably accomplish this by setting the environment variable on the fly. See Setting variables on the fly. Otherwise, the technique below might be useful.

If you maintain a multistage deployment you may find it helpful to set the environement automatically based on the filepath.

For example:


if File.expand_path(__FILE__) =~ /staging/
  set :environment, :staging
end

or


set :environment, Rails.env

In this case it would explicitely set the environment to :staging or default to :production.

Last edited by retr0h, Sat Nov 07 21:46:25 -0800 2009
Home | Edit | New
Versions: