X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/42887a1cae8ac3ddf4a7afd543b473d619ccf27b..0457132a07ccb7a507d2392fb8e7ce8b1e114e93:/cookbooks/web/definitions/rails_port.rb?ds=sidebyside diff --git a/cookbooks/web/definitions/rails_port.rb b/cookbooks/web/definitions/rails_port.rb index a0eb7eb79..a6bf96963 100644 --- a/cookbooks/web/definitions/rails_port.rb +++ b/cookbooks/web/definitions/rails_port.rb @@ -17,6 +17,8 @@ # limitations under the License. # +require "yaml" + define :rails_port, :action => [ :create, :enable ] do name = params[:name] ruby_version = params[:ruby] || "1.9.1" @@ -76,6 +78,7 @@ define :rails_port, :action => [ :create, :enable ] do execute "#{rails_directory}/public/assets" do action :nothing command "rake#{ruby_version} assets:precompile" + environment "RAILS_ENV" => "production" cwd rails_directory user rails_user group rails_group @@ -205,17 +208,26 @@ define :rails_port, :action => [ :create, :enable ] do line.gsub!(/^( *)require_terms_seen:.*$/, "\\1require_terms_seen: true") line.gsub!(/^( *)require_terms_agreed:.*$/, "\\1require_terms_agreed: true") - if params[:piwik_location] - line.gsub!(/^( *)#piwik_location:.*$/, "\\1piwik_location: \"#{params[:piwik_location]}\"") - line.gsub!(/^( *)#piwik_site:.*$/, "\\1piwik_site: #{params[:piwik_site]}") - line.gsub!(/^( *)#piwik_signup_goal:.*$/, "\\1piwik_signup_goal: #{params[:piwik_signup_goal]}") - end - line end notifies :touch, resources(:file => "#{rails_directory}/tmp/restart.txt") end + if params[:piwik_configuration] + file "#{rails_directory}/config/piwik.yml" do + owner rails_user + group rails_group + mode 0664 + content YAML.dump(params[:piwik_configuration]) + notifies :run, resources(:execute => "#{rails_directory}/public/assets") + end + else + file "#{rails_directory}/config/piwik.yml" do + action :delete + notifies :run, resources(:execute => "#{rails_directory}/public/assets") + end + end + execute "#{rails_directory}/lib/quad_tile/extconf.rb" do command "ruby extconf.rb" cwd "#{rails_directory}/lib/quad_tile"