-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Seth Vargo <[email protected]>
- Loading branch information
Showing
6 changed files
with
171 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# | ||
# Author:: Barry Steinglass (<[email protected]>) | ||
# Author:: Koseki Kengo (<[email protected]>) | ||
# Cookbook Name:: wordpress | ||
# Attributes:: wordpress | ||
# | ||
# Copyright 2009-2010, Opscode, Inc. | ||
# Copyright 2009-2013, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
|
@@ -26,3 +27,26 @@ | |
default['wordpress']['db']['database'] = "wordpressdb" | ||
default['wordpress']['db']['user'] = "wordpressuser" | ||
default['wordpress']['server_aliases'] = [node['fqdn']] | ||
|
||
# Languages | ||
default['wordpress']['languages']['lang'] = '' | ||
default['wordpress']['languages']['version'] = '' | ||
default['wordpress']['languages']['repourl'] = 'http://translate.wordpress.org/projects/wp' | ||
default['wordpress']['languages']['projects'] = ['main', 'admin', 'admin_network', 'continents_cities'] | ||
default['wordpress']['languages']['themes'] = [] | ||
default['wordpress']['languages']['project_pathes'] = { | ||
'main' => '/', | ||
'admin' => '/admin/', | ||
'admin_network' => '/admin/network/', | ||
'continents_cities' => '/cc/' | ||
} | ||
%w{ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty}.each do |year| | ||
default['wordpress']['languages']['project_pathes']["twenty#{year}"] = "/twenty#{year}/" | ||
end | ||
node['wordpress']['languages']['project_pathes'].each do |project,project_path| | ||
# http://translate.wordpress.org/projects/wp/3.5.x/admin/network/ja/default/export-translations?format=mo | ||
default['wordpress']['languages']['urls'][project] = | ||
node['wordpress']['languages']['repourl'] + '/' + | ||
node['wordpress']['languages']['version'] + project_path + | ||
node['wordpress']['languages']['lang'] + '/default/export-translations?format=mo' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# Cookbook Name:: wordpress | ||
# Recipe:: languages | ||
# Author:: Koseki Kengo <[email protected]> | ||
# | ||
# Copyright 2013, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
include_recipe "wordpress" | ||
|
||
directory "#{node['wordpress']['dir']}/wp-content/languages" do | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
action :create | ||
recursive true | ||
end | ||
|
||
unless node['wordpress']['languages']['lang'].to_s.empty? && | ||
node['wordpress']['languages']['version'].to_s.empty? | ||
urls = node['wordpress']['languages']['urls'] | ||
node['wordpress']['languages']['projects'].to_a.each do |project| | ||
next unless urls[project] | ||
|
||
file = "#{node['wordpress']['dir']}/wp-content/languages/" | ||
file += "#{project.tr('_', '-')}-" if project != 'main' | ||
file += "#{node['wordpress']['languages']['lang']}.mo" | ||
|
||
remote_file file do | ||
source urls[project] | ||
owner "root" | ||
group "root" | ||
mode "0644" | ||
action :create_if_missing | ||
end | ||
end | ||
|
||
node['wordpress']['languages']['themes'].to_a.each do |project| | ||
next unless urls[project] | ||
|
||
file = "#{node['wordpress']['dir']}/wp-content/themes/#{project}/languages/" | ||
file += "#{node['wordpress']['languages']['lang']}.mo" | ||
|
||
remote_file file do | ||
source urls[project] | ||
owner "root" | ||
group "root" | ||
mode "0644" | ||
action :create_if_missing | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters