Regrettably, I would suggest moving your variables that you need to share to
a config file (I like AppConfig) - (YAML) and loading that with Capistrano.
There is no much better way.

On 12 September 2010 18:44, Paul Schreiber <[email protected]> wrote:

> The capistrano deployment script for my rails app currently does this:
>
> after "deploy:update_code", :build_native_gems
>
> task :build_native_gems do
>   if ENV['RAILS_ENV'] == "production"
>     java_home = "/home/foo/jdk1.6.0_21"
>   else # RAILS_ENV is 'staging'
>     java_home = "/usr/lib/jvm/java-6-openjdk"
>   end
>
>   unless ENV['BUILD_GEMS'] and (ENV['BUILD_GEMS'] == '0')
>     run "JAVA_HOME=#{java_home} rake -f #{release_path}/Rakefile
> gems:build:force"
>   end
> end
>
> This is a bit of hack and not very DRY, as JAVA_HOME is already set in
> config/environments/production.rb (and stage.rb).
>
> Is there a way to share my environment variables so I only have to define
> them once?
>
>
> Paul
>

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to