aboutsummaryrefslogblamecommitdiffstats
path: root/lib/capistrano/tasks/configure_piwik.rake
blob: e69e10b96e69d0bf53f42f263f5ca94e2cebcae4 (plain) (tree)
1
2
3

                    
                     














                                                                  
                                                                
   
# :mode=ruby:
namespace :deploy do
  namespace :piwik do
    desc 'Configure piwik for site'
    task :configure 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)
        end
      end
    end
  end

  before 'deploy:symlink:linked_files', 'deploy:piwik:configure'
end