2 # Cookbook Name:: mediawiki
3 # Provider:: mediawiki_skin
5 # Copyright 2015, OpenStreetMap Foundation
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
27 if new_resource.source
28 remote_directory skin_directory do
30 source new_resource.source
31 owner node[:mediawiki][:user]
32 group node[:mediawiki][:group]
34 files_owner node[:mediawiki][:user]
35 files_group node[:mediawiki][:group]
39 skin_repository = new_resource.repository || default_repository
40 skin_revision = new_resource.revision || "REL#{skin_version}".tr(".", "_")
44 repository skin_repository
45 revision skin_revision
46 enable_submodules true
47 user node[:mediawiki][:user]
48 group node[:mediawiki][:group]
49 ignore_failure skin_repository.start_with?("git://github.com/wikimedia/mediawiki-skins")
53 if new_resource.template # ~FC023
54 template "#{mediawiki_directory}/LocalSettings.d/Skin-#{new_resource.name}.inc.php" do
56 source new_resource.template
57 user node[:mediawiki][:user]
58 group node[:mediawiki][:group]
60 variables new_resource.variables
63 skin_script = "#{skin_directory}/#{new_resource.name}.php"
65 file "#{mediawiki_directory}/LocalSettings.d/Skin-#{new_resource.name}.inc.php" do
67 content "<?php require_once('#{skin_script}');\n"
68 user node[:mediawiki][:user]
69 group node[:mediawiki][:group]
71 only_if { ::File.exist?(skin_script) }
77 directory skin_directory do
82 file "#{mediawiki_directory}/LocalSettings.d/Skin-#{new_resource.name}.inc.php" do
90 node[:mediawiki][:sites][new_resource.site][:directory]
93 def mediawiki_directory
98 "#{mediawiki_directory}/skins/#{new_resource.name}"
102 new_resource.version || node[:mediawiki][:sites][new_resource.site][:version]
105 def default_repository
106 "git://github.com/wikimedia/mediawiki-skins-#{new_resource.name}.git"