]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/resources/site.rb
mediawiki: Set default branch to 1.24 + mw lang bundle 2015.03
[chef.git] / cookbooks / mediawiki / resources / site.rb
1 #
2 # Cookbook Name:: mediawiki
3 # Resource:: mediawiki_site
4 #
5 # Copyright 2015, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 actions :create, :delete
21 default_action :create
22
23 attribute :name, :kind_of => String, :name_attribute => true
24 attribute :aliases, :kind_of => [String, Array]
25 attribute :directory, :kind_of => String
26 attribute :version, :kind_of => String, :default => "1.24"
27 attribute :database_name, :kind_of => String, :required => true
28 attribute :database_user, :kind_of => String, :required => true
29 attribute :database_password, :kind_of => String, :required => true
30 attribute :sitename, :kind_of => String, :default => "OpenStreetMap Wiki"
31 attribute :metanamespace, :kind_of => String, :default => "OpenStreetMap"
32 attribute :logo, :kind_of => String, :default => "$wgStylePath/common/images/wiki.png"
33 attribute :email_contact, :kind_of => String, :default => ""
34 attribute :email_sender, :kind_of => String, :default => ""
35 attribute :email_sender_name, :kind_of => String, :default => "MediaWiki Mail"
36 attribute :commons, :kind_of => [TrueClass, FalseClass], :default => true
37 attribute :skin, :kind_of => String, :default =>  "vector"
38 attribute :site_notice, :kind_of => String, :default => ""
39 attribute :site_readonly, :kind_of => [TrueClass, FalseClass], :default => false
40 attribute :admin_user, :kind_of => String, :default => "Admin"
41 attribute :admin_password, :kind_of => String, :required => true
42 attribute :ssl_enabled, :kind_of => [TrueClass, FalseClass], :default => false
43 attribute :ssl_certificate, :kind_of => String
44 attribute :ssl_certificate_chain, :kind_of => String
45 attribute :private_accounts, :kind_of => [TrueClass, FalseClass], :default => false
46 attribute :private, :kind_of => [TrueClass, FalseClass], :default => false
47 attribute :recaptcha_public_key, :kind_of => String
48 attribute :recaptcha_private_key, :kind_of => String
49 attribute :reload_apache, :kind_of => [TrueClass, FalseClass], :default => true
50
51 def after_created
52   notifies :reload, "service[apache2]" if reload_apache
53 end
54
55 def database_params
56   {
57     :host => "localhost",
58     :name => database_name,
59     :username => database_user,
60     :password => database_password
61   }
62 end
63
64 def mediawiki_params
65   {
66     :sitename => sitename,
67     :metanamespace => metanamespace,
68     :logo => logo,
69     :email_contact => email_contact,
70     :email_sender => email_sender,
71     :email_sender_name => email_sender_name,
72     :commons => commons,
73     :skin => skin,
74     :site_notice => site_notice,
75     :site_readonly => site_readonly,
76     :ssl_enabled => ssl_enabled,
77     :private_accounts => private_accounts,
78     :private => private
79   }
80 end