Skip to content

Instantly share code, notes, and snippets.

@scrooloose
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrooloose/e076ecf7bdd27c0a4439 to your computer and use it in GitHub Desktop.
Save scrooloose/e076ecf7bdd27c0a4439 to your computer and use it in GitHub Desktop.
module OpsWorks
module RailsConfiguration
def self.determine_database_adapter(app_name, app_config, app_root_path, options = {})
options = {
:consult_gemfile => true,
:force => false
}.update(options)
if options[:force] || app_config[:database][:adapter].blank?
# a bunch of confusing shit
else
app_config[:database][:adapter]
end
end
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"))
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment