aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2014-12-07 22:36:37 +0100
committerHarald Eilertsen <haraldei@anduin.net>2014-12-07 22:36:37 +0100
commit94c8330dd73f872e844e91ffe6e5a45c70d07c8f (patch)
treed519d02b164f6bb2247a58a642e735cd1f7baf52 /lib
parentd01374d7221e11fc9d35f6f6100db08b5f3032c1 (diff)
downloadhmnoweb-94c8330dd73f872e844e91ffe6e5a45c70d07c8f.tar.gz
hmnoweb-94c8330dd73f872e844e91ffe6e5a45c70d07c8f.tar.bz2
hmnoweb-94c8330dd73f872e844e91ffe6e5a45c70d07c8f.zip
Add capistrano task and config for deploying piwik.
Diffstat (limited to 'lib')
-rw-r--r--lib/capistrano/tasks/configure_piwik.rake20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/capistrano/tasks/configure_piwik.rake b/lib/capistrano/tasks/configure_piwik.rake
new file mode 100644
index 0000000..e56f37e
--- /dev/null
+++ b/lib/capistrano/tasks/configure_piwik.rake
@@ -0,0 +1,20 @@
+# :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', 'deploy:piwik:config'
+end \ No newline at end of file