]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/web/resources/rails_port.rb
Remove refernces to mapquest and mapzen API keys
[chef.git] / cookbooks / web / resources / rails_port.rb
index e3276da2c5b3c6e8bbfb933aacd535a65ded09b4..12c0206529c94e4fdd655eb0cfc26793b73d8ec6 100644 (file)
@@ -244,14 +244,6 @@ action :create do
       line.gsub!(/^( *)#wikipedia_auth_secret:.*$/, "\\1wikipedia_auth_secret: \"#{new_resource.wikipedia_auth_secret}\"")
     end
 
-    if new_resource.mapquest_key
-      line.gsub!(/^( *)#mapquest_key:.*$/, "\\1mapquest_key: \"#{new_resource.mapquest_key}\"")
-    end
-
-    if new_resource.mapzen_valhalla_key
-      line.gsub!(/^( *)#mapzen_valhalla_key:.*$/, "\\1mapzen_valhalla_key: \"#{new_resource.mapzen_valhalla_key}\"")
-    end
-
     if new_resource.thunderforest_key
       line.gsub!(/^( *)#thunderforest_key:.*$/, "\\1thunderforest_key: \"#{new_resource.thunderforest_key}\"")
     end
@@ -275,16 +267,23 @@ action :create do
     line
   end
 
-  file "#{rails_directory}/config/application.yml" do
-    action(lazy { File.exist?("#{rails_directory}/config/example.application.yml") ? :create : :delete })
+  file "create:#{rails_directory}/config/application.yml" do
+    path "#{rails_directory}/config/application.yml"
     owner new_resource.user
     group new_resource.group
     mode 0o664
     content application_yml
     notifies :run, "execute[#{rails_directory}/public/assets]"
+    only_if { ::File.exist?("#{rails_directory}/config/example.application.yml") }
+  end
+
+  file "delete:#{rails_directory}/config/application.yml" do
+    path "#{rails_directory}/config/application.yml"
+    action :delete
+    not_if { ::File.exist?("#{rails_directory}/config/example.application.yml") }
   end
 
-  settings = new_resource.slice(
+  settings = new_resource.to_hash.slice(
     "email_from",
     "status",
     "messages_domain",
@@ -334,7 +333,7 @@ action :create do
     mode 0o664
     content YAML.dump(settings)
     notifies :run, "execute[#{rails_directory}/public/assets]"
-    only_if { File.exist?("#{rails_directory}/config/settings.yml") }
+    only_if { ::File.exist?("#{rails_directory}/config/settings.yml") }
   end
 
   if new_resource.piwik_configuration