From 60361999f4b1db3f459026811c1469fc4d193e50 Mon Sep 17 00:00:00 2001 From: Cyprian Kowalczyk Date: Wed, 6 Jan 2016 17:30:42 +0000 Subject: [PATCH 1/2] DRY Rails bundle install call --- rails/libraries/rails_configuration.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rails/libraries/rails_configuration.rb b/rails/libraries/rails_configuration.rb index 4e392dfcf1..938ef6f70d 100644 --- a/rails/libraries/rails_configuration.rb +++ b/rails/libraries/rails_configuration.rb @@ -40,8 +40,9 @@ def self.determine_database_adapter(app_name, app_config, app_root_path, options def self.bundle(app_name, app_config, app_root_path) if File.exists?("#{app_root_path}/Gemfile") Chef::Log.info("Gemfile detected. Running bundle install.") - Chef::Log.info("sudo su - #{app_config[:user]} -c 'cd #{app_root_path} && /usr/local/bin/bundle install --path #{app_config[:home]}/.bundler/#{app_name} --without=#{app_config[:ignore_bundler_groups].join(' ')}'") - Chef::Log.info(OpsWorks::ShellOut.shellout("sudo su - #{app_config[:user]} -c 'cd #{app_root_path} && /usr/local/bin/bundle install --path #{app_config[:home]}/.bundler/#{app_name} --without=#{app_config[:ignore_bundler_groups].join(' ')}' 2>&1")) + cmd = "sudo su - #{app_config[:user]} -c 'cd #{app_root_path} && /usr/local/bin/bundle install --path #{app_config[:home]}/.bundler/#{app_name} --without=#{app_config[:ignore_bundler_groups].join(' ')}' 2>&1" + Chef::Log.info(cmd) + Chef::Log.info(OpsWorks::ShellOut.shellout(cmd)) end end end From bd55285d475a3b102d64a205f497bdcb1b9a04ac Mon Sep 17 00:00:00 2001 From: Cyprian Kowalczyk Date: Wed, 6 Jan 2016 17:33:19 +0000 Subject: [PATCH 2/2] Allow to pass extra bundler options to bundle install This should solve the missing `--deployment` directive breaking certain deployments --- rails/libraries/rails_configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails/libraries/rails_configuration.rb b/rails/libraries/rails_configuration.rb index 938ef6f70d..37edcde8ee 100644 --- a/rails/libraries/rails_configuration.rb +++ b/rails/libraries/rails_configuration.rb @@ -40,7 +40,7 @@ def self.determine_database_adapter(app_name, app_config, app_root_path, options def self.bundle(app_name, app_config, app_root_path) if File.exists?("#{app_root_path}/Gemfile") Chef::Log.info("Gemfile detected. Running bundle install.") - cmd = "sudo su - #{app_config[:user]} -c 'cd #{app_root_path} && /usr/local/bin/bundle install --path #{app_config[:home]}/.bundler/#{app_name} --without=#{app_config[:ignore_bundler_groups].join(' ')}' 2>&1" + cmd = "sudo su - #{app_config[:user]} -c 'cd #{app_root_path} && /usr/local/bin/bundle install --path #{app_config[:home]}/.bundler/#{app_name} --without=#{app_config[:ignore_bundler_groups].join(' ')} #{app_config[:extra_bundler_options]}' 2>&1" Chef::Log.info(cmd) Chef::Log.info(OpsWorks::ShellOut.shellout(cmd)) end