Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Added environment variables support for assets precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Rzegocki committed Apr 27, 2016
1 parent af560db commit f24e742
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion libraries/drivers_framework_rails.rb
Expand Up @@ -16,15 +16,20 @@ def raw_out
def after_deploy(context) def after_deploy(context)
output = out output = out
deploy_to = deploy_dir(app) deploy_to = deploy_dir(app)
env = environment


context.execute 'assets:precompile' do context.execute 'assets:precompile' do
command output[:assets_precompilation_command] command output[:assets_precompilation_command]
user node['deployer']['user'] user node['deployer']['user']
cwd File.join(deploy_to, 'current') cwd File.join(deploy_to, 'current')
group www_group group www_group
environment output[:deploy_environment] environment env
end if out[:assets_precompile] end if out[:assets_precompile]
end end

def environment
app['environment'].merge(out[:deploy_environment])
end
end end
end end
end end
2 changes: 1 addition & 1 deletion spec/unit/recipes/deploy_spec.rb
Expand Up @@ -61,7 +61,7 @@
expect(chef_run).to run_execute('start unicorn') expect(chef_run).to run_execute('start unicorn')
expect(chef_run).to run_execute('assets:precompile').with( expect(chef_run).to run_execute('assets:precompile').with(
command: '/usr/local/bin/bundle exec rake assets:precompile', command: '/usr/local/bin/bundle exec rake assets:precompile',
environment: { 'RAILS_ENV' => 'production' }, environment: { 'ENV_VAR1' => 'test', 'ENV_VAR2' => 'some data', 'RAILS_ENV' => 'production' },
cwd: "/srv/www/#{aws_opsworks_app['shortname']}/current" cwd: "/srv/www/#{aws_opsworks_app['shortname']}/current"
) )
expect(deploy).to notify('service[nginx]').to(:reload).delayed expect(deploy).to notify('service[nginx]').to(:reload).delayed
Expand Down

0 comments on commit f24e742

Please sign in to comment.