From 1232a5e141a8af17cae52b8a486c71b1e2119437 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 11 Dec 2014 20:49:07 +0100 Subject: Generate piwik config directly rather than through erb. --- lib/capistrano/tasks/configure_piwik.rake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/capistrano/tasks/configure_piwik.rake b/lib/capistrano/tasks/configure_piwik.rake index dae2e28..93a697b 100644 --- a/lib/capistrano/tasks/configure_piwik.rake +++ b/lib/capistrano/tasks/configure_piwik.rake @@ -6,11 +6,18 @@ namespace :deploy do output_file = File.join(shared_path, 'config', 'piwik.yml') on roles(:app) do unless test "[ -f #{output_file} ]" - template = IO.read(File.join('config', 'piwik.yml.erb')) - c = ERB.new(template) - site_id = fetch(:piwik_site_id) - url = fetch(:piwik_url) - upload!(StringIO.new(c.result(binding)), output_file) + conf = { + fetch(:rails_env) => { + 'piwik' => { + 'id_site' => fetch(:piwik_site_id), + 'url' => fetch(:piwik_url), + 'disabled' => fetch(:piwik_disabled, false), + 'use_async' => fetch(:piwik_async, false), + } + } + } + + upload!(StringIO.new(conf.to_yaml), output_file) end end end -- cgit v1.2.3