Rails environmental variable in application_ruby


#1

I am using the application_ruby libraries to install a rails app. My chef
environment name is different from the RAILS_ENV variable I want the "bundler"
and “precompile_assets” actions to run as.

When I write

rails do
environment stage
bundler true
precompile_assets true
end

The bundler and precompile_assets do not run as RAILS_ENV=stage but run as the
chef environment name.

Even "environment ‘RAILS_ENV’ => ‘stage’ " doesn’t work.

This works perfectly fine for the application libraries and the deploy resource
of chef,but not for the application_ruby library which is based off of the
deploy and application resources.

Anyone knows how I can make this work. I don’t want to set the ruby environment
name to stage for various different reasons, so that solution isn’t going to
work for me.

Thanks,

Rishi


#2

I don’t use the application_ruby providers but you can try environment_name instead of environment.

https://github.com/poise/application_ruby/blob/master/providers/rails.rb#L33-35
https://github.com/poise/application_ruby/blob/master/resources/rails.rb#L21
https://github.com/poise/application/blob/master/resources/default.rb#L34

On Tuesday, June 10, 2014 at 1:43 PM, rgokhale@patientslikeme.com wrote:

I am using the application_ruby libraries to install a rails app. My chef
environment name is different from the RAILS_ENV variable I want the "bundler"
and “precompile_assets” actions to run as.

When I write

rails do
environment stage
bundler true
precompile_assets true
end

The bundler and precompile_assets do not run as RAILS_ENV=stage but run as the
chef environment name.

Even "environment ‘RAILS_ENV’ => ‘stage’ " doesn’t work.

This works perfectly fine for the application libraries and the deploy resource
of chef,but not for the application_ruby library which is based off of the
deploy and application resources.

Anyone knows how I can make this work. I don’t want to set the ruby environment
name to stage for various different reasons, so that solution isn’t going to
work for me.

Thanks,

Rishi