Commit 6a180293 authored by Markus Guenther's avatar Markus Guenther
Browse files

[FEATURE] Make the typo3-solr cookbook solr 4.10 compatible

parent 39b8d8ed
action :add do action :add do
uri = URI.parse("https://forge.typo3.org/projects/extension-solr/repository/show?rev=solr_#{new_resource.extension}.x") uri = URI.parse("https://raw.githubusercontent.com/TYPO3-Solr/ext-solr/release-#{new_resource.extension}.x/README.md")
request = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP.new(uri.host, uri.port)
request.use_ssl = true request.use_ssl = true
...@@ -7,13 +7,21 @@ action :add do ...@@ -7,13 +7,21 @@ action :add do
response = request.request_head uri.request_uri response = request.request_head uri.request_uri
if response.code.to_i == 200 if response.code.to_i == 200
remote_branch = "solr_#{new_resource.extension}.x" remote_branch = "release-#{new_resource.extension}.x"
else else
remote_branch = "master" remote_branch = "master"
end end
resources_path = "Resources/Solr" resources_path = "Resources/Solr"
if Gem::Version.new(new_resource.extension) >= Gem::Version.new('3.1')
ext_solr_uri = "https://raw.githubusercontent.com/TYPO3-Solr/ext-solr/#{remote_branch}/#{resources_path}"
plugin_uri = "https://github.com/TYPO3-Solr/solr-typo3-plugin/releases/download/release-#{new_resource.plugin}"
else
ext_solr_uri = "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}"
plugin_uri = "http://www.typo3-solr.com/fileadmin/files/solr"
end
service "tomcat" do service "tomcat" do
service_name "tomcat6" service_name "tomcat6"
supports :restart => true, :reload => true, :status => true supports :restart => true, :reload => true, :status => true
...@@ -100,7 +108,7 @@ action :add do ...@@ -100,7 +108,7 @@ action :add do
%w{ protwords.txt schema.xml synonyms.txt }.each do |file| %w{ protwords.txt schema.xml synonyms.txt }.each do |file|
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/#{file}" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/#{file}" do
source "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}/typo3cores/conf/#{language}/#{file}" source "#{ext_solr_uri}/typo3cores/conf/#{language}/#{file}"
action :create_if_missing action :create_if_missing
owner node[:tomcat][:user] owner node[:tomcat][:user]
mode 0644 mode 0644
...@@ -108,14 +116,14 @@ action :add do ...@@ -108,14 +116,14 @@ action :add do
end end
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/_schema_analysis_stopwords_#{language}.json" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/_schema_analysis_stopwords_#{language}.json" do
source "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}/typo3cores/conf/#{language}/_schema_analysis_stopwords_#{language}.json" source "#{ext_solr_uri}/typo3cores/conf/#{language}/_schema_analysis_stopwords_#{language}.json"
action :create_if_missing action :create_if_missing
owner node[:tomcat][:user] owner node[:tomcat][:user]
mode 0644 mode 0644
end end
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/german-common-nouns.txt" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{language}/german-common-nouns.txt" do
source "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}/typo3cores/conf/#{language}/german-common-nouns.txt" source "#{ext_solr_uri}/typo3cores/conf/#{language}/german-common-nouns.txt"
action :create_if_missing action :create_if_missing
owner node[:tomcat][:user] owner node[:tomcat][:user]
mode 0644 mode 0644
...@@ -125,7 +133,7 @@ action :add do ...@@ -125,7 +133,7 @@ action :add do
%w{ elevate.xml general_schema_fields.xml general_schema_types.xml solrconfig.xml }.each do |file| %w{ elevate.xml general_schema_fields.xml general_schema_types.xml solrconfig.xml }.each do |file|
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{file}" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/#{file}" do
source "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}/typo3cores/conf/#{file}" source "#{ext_solr_uri}/typo3cores/conf/#{file}"
action :create_if_missing action :create_if_missing
owner node[:tomcat][:user] owner node[:tomcat][:user]
mode 0664 mode 0664
...@@ -133,7 +141,7 @@ action :add do ...@@ -133,7 +141,7 @@ action :add do
end end
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/currency.xml" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3cores/conf/currency.xml" do
source "https://forge.typo3.org/projects/extension-solr/repository/revisions/#{remote_branch}/raw/#{resources_path}/typo3cores/conf/currency.xml" source "#{ext_solr_uri}/typo3cores/conf/currency.xml"
action :create_if_missing action :create_if_missing
owner node[:tomcat][:user] owner node[:tomcat][:user]
mode 0644 mode 0644
...@@ -192,7 +200,7 @@ action :add do ...@@ -192,7 +200,7 @@ action :add do
# old typo3 solr plugin # old typo3 solr plugin
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3lib/solr-typo3-plugin-#{new_resource.plugin}.jar" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3lib/solr-typo3-plugin-#{new_resource.plugin}.jar" do
source "http://www.typo3-solr.com/fileadmin/files/solr/solr-typo3-plugin-#{new_resource.plugin}.jar" source "#{plugin_uri}/solr-typo3-plugin-#{new_resource.plugin}.jar"
mode 0644 mode 0644
notifies :restart, "service[tomcat]", :immediately notifies :restart, "service[tomcat]", :immediately
only_if { Gem::Version.new(new_resource.plugin) > Gem::Version.new('0.0.0') } only_if { Gem::Version.new(new_resource.plugin) > Gem::Version.new('0.0.0') }
...@@ -201,7 +209,7 @@ action :add do ...@@ -201,7 +209,7 @@ action :add do
# new typo3-solr plugins # new typo3-solr plugins
remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3lib/solr-typo3-access-#{new_resource.plugin_access}.jar" do remote_file "#{node[:typo3_solr][:solr][:solr_home]}/#{new_resource.name}/typo3lib/solr-typo3-access-#{new_resource.plugin_access}.jar" do
source "http://www.typo3-solr.com/fileadmin/files/solr/Solr4x/solr-typo3-access-#{new_resource.plugin_access}.jar" source "http://www.typo3-solr.com/fileadmin/files/solr/Solr4x/solr-typo3-access-#{new_resource.plugin_access}.jar"
mode 0644 mode 0644
notifies :restart, "service[tomcat]", :immediately notifies :restart, "service[tomcat]", :immediately
only_if { Gem::Version.new(new_resource.plugin_access) > Gem::Version.new('0.0.0') } only_if { Gem::Version.new(new_resource.plugin_access) > Gem::Version.new('0.0.0') }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment