2 # Cookbook Name:: wordpress
 
   3 # Provider:: wordpress_theme
 
   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 theme_directory do
 
  30       source new_resource.source
 
  31       owner node[:wordpress][:user]
 
  32       group node[:wordpress][:group]
 
  34       files_owner node[:wordpress][:user]
 
  35       files_group node[:wordpress][:group]
 
  39     theme_repository = new_resource.repository || default_repository
 
  41     if theme_repository.end_with?(".git")
 
  42       git theme_directory do
 
  44         repository theme_repository
 
  45         revision new_resource.revision
 
  46         user node[:wordpress][:user]
 
  47         group node[:wordpress][:group]
 
  50       subversion theme_directory do
 
  52         repository theme_repository
 
  53         user node[:wordpress][:user]
 
  54         group node[:wordpress][:group]
 
  55         ignore_failure theme_repository.start_with?("http://themes.svn.wordpress.org/")
 
  62   directory theme_directory do
 
  71   node[:wordpress][:sites][new_resource.site][:directory]
 
  75   "#{site_directory}/wp-content/themes/#{new_resource.name}"
 
  78 def default_repository
 
  79   "http://themes.svn.wordpress.org/#{new_resource.name}/#{new_resource.version}"