-directory "/data/crm.osmfoundation.org/civicrm" do
- owner "www-data"
- group "www-data"
- mode "0775"
-end
-
-ruby_block "#{civicrm_directory}/civicrm.settings.php" do
- block do
- out = File.new("#{civicrm_directory}/civicrm.settings.php", "w")
-
- File.foreach("#{civicrm_directory}/templates/CRM/common/civicrm.settings.php.tpl") do |line|
- line.gsub!(/%%cms%%/, "Drupal")
- line.gsub!(/%%CMSdbUser%%/, "civicrm")
- line.gsub!(/%%CMSdbPass%%/, database_password)
- line.gsub!(/%%CMSdbHost%%/, "localhost")
- line.gsub!(/%%CMSdbName%%/, "civicrm")
- line.gsub!(/%%dbUser%%/, "civicrm")
- line.gsub!(/%%dbPass%%/, database_password)
- line.gsub!(/%%dbHost%%/, "localhost")
- line.gsub!(/%%dbName%%/, "civicrm")
- line.gsub!(/%%crmRoot%%/, "/usr/share/drupal7/sites/all/modules/civicrm")
- line.gsub!(/%%templateCompileDir%%/, "/data/crm.osmfoundation.org/civicrm")
- line.gsub!(/%%baseURL%%/, "http://crm.osmfoundation.org/")
- line.gsub!(/%%siteKey%%/, site_key)
-
- out.print(line)
- end
-
- out.close
- end
-
- not_if do
- File.exist?("#{civicrm_directory}/civicrm.settings.php") and
- File.mtime("#{civicrm_directory}/civicrm.settings.php") >= File.mtime("#{civicrm_directory}/templates/CRM/common/civicrm.settings.php.tpl")
- end