]> git.openstreetmap.org Git - chef.git/blob - cookbooks/dev/templates/default/rails.setup.rb.erb
Add a load more cookbooks to the public repository
[chef.git] / cookbooks / dev / templates / default / rails.setup.rb.erb
1 unless Object.const_defined?(:Rake) or Object.const_defined?(:POTLATCH2_KEY)
2   OpenStreetMap::Application.config.after_initialize do
3     unless webmaster = User.find_by_email("webmaster@openstreetmap.org")
4       webmaster = User.create({
5         :display_name => "OpenStreetMap Webmaster",
6         :email => "webmaster@openstreetmap.org",
7         :pass_crypt => SecureRandom.hex,
8         :status => "active"
9       }, :without_protection => true)
10     end
11
12     permissions = Hash[ClientApplication.all_permissions.map { |p| [ p, true ] }]
13
14     unless id = webmaster.client_applications.find_by_name("iD")
15       id = ClientApplication.create(permissions.merge({
16         :name => "iD",
17         :url => "http://<%= @site %>/",
18       }), :without_protection => true)
19     end
20
21     ID_KEY = id.key
22
23     unless potlatch = webmaster.client_applications.find_by_name("Potlatch 2")
24       potlatch = ClientApplication.create(permissions.merge({
25         :name => "Potlatch 2",
26         :url => "http://<%= @site %>/",
27       }), :without_protection => true)
28     end
29
30     POTLATCH2_KEY = potlatch.key
31
32     unless website = webmaster.client_applications.find_by_name("Web Site")
33       website = ClientApplication.create(permissions.merge({
34         :name => "Web Site",
35         :url => "http://<%= @site %>/",
36       }), :without_protection => true)
37     end
38
39     OAUTH_KEY = website.key
40   end
41 end