Skip to content

Instantly share code, notes, and snippets.

@DriesS
Created August 23, 2011 08:06
Show Gist options
  • Save DriesS/1164607 to your computer and use it in GitHub Desktop.
Save DriesS/1164607 to your computer and use it in GitHub Desktop.
include_recipe "deploy"
node[:deploy].each do |application, deploy|
deploy = node[:deploy][application]
unless application.match(/_stats$/)
execute "restart Rails app #{application}" do
cwd deploy[:current_path]
command node[:scalarium][:rails_stack][:restart_command]
action :nothing
end
node[:deploy][application][:database][:adapter] = Scalarium::RailsConfiguration.determine_database_adapter(application, node[:deploy][application], "#{node[:deploy][application][:deploy_to]}/current", :force => node[:force_database_adapter_detection])
template "#{deploy[:deploy_to]}/shared/config/vanity.yml" do
source "vanity.yml.erb"
cookbook 'rails'
mode "0660"
group deploy[:group]
owner deploy[:user]
variables(:database => deploy[:database], :environment => deploy[:rails_env])
notifies :run, resources(:execute => "restart Rails app #{application}")
only_if do
File.exists?("#{deploy[:deploy_to]}") && File.exists?("#{deploy[:deploy_to]}/shared/config/")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment