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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to