From 7f7db12f9f7da1cf7624532c406b14eed511b01e Mon Sep 17 00:00:00 2001 From: Skud Date: Tue, 26 Mar 2013 13:23:35 +1100 Subject: [PATCH] added analytics tracking code w/ per-env config --- app/views/layouts/application.html.haml | 2 ++ config/environments/development.rb | 1 + config/environments/production.rb | 5 +++++ config/environments/staging.rb | 1 + config/environments/test.rb | 1 + spec/views/layouts/application_spec.rb | 6 ++++++ 6 files changed, 16 insertions(+) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 01d860bb6..d8a8088e4 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -24,3 +24,5 @@ \================================================== / Placed at the end of the document so the pages load faster = javascript_include_tag "application" + + = Growstuff::Application.config.analytics_code diff --git a/config/environments/development.rb b/config/environments/development.rb index 7dd35bd30..1ee8742f6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -50,5 +50,6 @@ Growstuff::Application.configure do Growstuff::Application.configure do config.site_name = "Growstuff (dev)" + config.analytics_code = '' end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 5eea36d96..03d206851 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -80,6 +80,11 @@ Growstuff::Application.configure do Growstuff::Application.configure do config.site_name = "Growstuff" + config.analytics_code = <<-eos + + + + eos end end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 5c891812a..1ad079660 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -80,6 +80,7 @@ Growstuff::Application.configure do Growstuff::Application.configure do config.site_name = "Growstuff (staging)" + config.analytics_code = '' end end diff --git a/config/environments/test.rb b/config/environments/test.rb index dec52612e..593ce6278 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -42,6 +42,7 @@ Growstuff::Application.configure do Growstuff::Application.configure do config.site_name = "Growstuff (test)" + config.analytics_code = '' end end diff --git a/spec/views/layouts/application_spec.rb b/spec/views/layouts/application_spec.rb index 0cfa96582..51db99ef3 100644 --- a/spec/views/layouts/application_spec.rb +++ b/spec/views/layouts/application_spec.rb @@ -57,5 +57,11 @@ describe 'layouts/application.html.haml', :type => "view" do end end + it 'includes the analytics code' do + Growstuff::Application.config.analytics_code = 'ANALYTICS' + render + rendered.should contain 'ANALYTICS' + end + end end