2 # Cookbook Name:: taginfo
5 # Copyright 2014, 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.
20 include_recipe "apache::ssl"
21 include_recipe "passenger"
24 package "libsqlite3-dev"
26 package "libosmpbf-dev"
27 package "libprotobuf-dev"
28 package "libboost-dev"
29 package "libexpat1-dev"
30 package "libsparsehash-dev"
31 package "libgd2-xpm-dev"
42 gem_package "sinatra-r18n"
43 gem_package "rack-contrib"
45 node[:taginfo][:sites].each do |site|
47 directory = site[:directory] || "/srv/#{name}"
48 description = site[:description]
50 contact = site[:contact]
52 directory directory do
58 git "#{directory}/osmium" do
60 repository "git://github.com/joto/osmium.git"
66 git "#{directory}/taginfo" do
68 repository "git://github.com/joto/taginfo.git"
74 settings = edit_file "#{directory}/taginfo/taginfo-config-example.json" do |line|
75 line.gsub!(/^( *)"url": ".*",/, "\\1\"url\": \"http://#{name}/\",")
76 line.gsub!(/^( *)"description": ".*Change this text.*,/, "\\1\"description\": \"#{description}\",")
77 line.gsub!(/^( *)"icon": ".*",/, "\\1\"icon\": \"/img/logo/#{icon}.png\",")
78 line.gsub!(/^( *)"contact": "Anonymous",/, "\\1\"contact\": \"#{contact}\",")
79 line.gsub!(/^( *)"shortname": ".*",/, "\\1\"shortname\": \"Taginfo\",")
80 line.gsub!(/^( *)"contact": "somebody@example.com",/, "\\1\"contact\": \"webmaster@openstreetmap.org\",")
81 line.gsub!(/^( *)"cxxflags": ".*",/, "\\1\"cxxflags\": \"-I../../osmium/include\",")
86 file "#{directory}/taginfo-config.json" do
93 execute "#{directory}/taginfo/tagstats/Makefile" do
96 cwd "#{directory}/taginfo/tagstats"
99 subscribes :run, "git[#{directory}/osmium]"
100 subscribes :run, "git[#{directory}/taginfo]"
101 notifies :restart, "service[apache2]"
104 directory "#{directory}/data" do
111 template "apache.erb"
112 directory "#{directory}/taginfo/web/public"