analytics-rails 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7d9d6a499bfd4b6f026e2328ba678727b3b4489
4
- data.tar.gz: c26b0c43e11092584481746260c48dace6b4479b
3
+ metadata.gz: 563716f8414f1bce51cda967ac0d98ca294ee29a
4
+ data.tar.gz: 1a9f3f6af57e7fb4e94651235047afb55e32943d
5
5
  SHA512:
6
- metadata.gz: f85c4cd0a9de1b14329432f41760c285d689ce84aed722b595b402bb54916d35bd3b141e45ffb417f67bfe27ba3883e55767a201ee28eb35b04fbf9abce9664d
7
- data.tar.gz: 30f5bb5214247b57a977d29d7b32457856b67bee7f8c4b950a0026594e749ccbbb4b9ba204377f3c4082e9e23a8503959b067c9198ea9c16f31f6835d3c3fee4
6
+ metadata.gz: e85e1c31d498e2e5f982f27e2d7357deb8744852ddc6999fe5658ad870bfb64d3e6c4f47728b3eb61642cbeff78ea7384d62012c10106ae0a270d40b1e425361
7
+ data.tar.gz: 123a08cf343f25661a244ad6ed7b74caf0d8927ebafec9928375ce73b1e7a5b8261749837e648eda639c5c4c47c11ce421d75462137e2b10b76775b8e52a1309
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2013 Mattways
1
+ Copyright 2013 Museways
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,4 +1,8 @@
1
- {<img src="https://codeclimate.com/github/mattways/analytics-rails.png" />}[https://codeclimate.com/github/mattways/analytics-rails] {<img src="https://travis-ci.org/mattways/analytics-rails.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/analytics-rails] {<img src="https://gemnasium.com/mattways/analytics-rails.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/analytics-rails]
1
+ === WARNING: From version 0.0.8 and above the include tag will only be show in production environment.
2
+
3
+ ---
4
+
5
+ {<img src="https://badge.fury.io/rb/analytics-rails.png" alt="Gem Version" />}[http://badge.fury.io/rb/analytics-rails] {<img src="https://codeclimate.com/github/museways/analytics-rails.png" />}[https://codeclimate.com/github/museways/analytics-rails] {<img src="https://travis-ci.org/museways/analytics-rails.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/analytics-rails] {<img src="https://gemnasium.com/museways/analytics-rails.png" alt="Dependency Status" />}[https://gemnasium.com/museways/analytics-rails]
2
6
 
3
7
  = Analytics Rails
4
8
 
@@ -17,4 +21,4 @@ Then bundle:
17
21
  In your layout add a line like this in your head:
18
22
  <%= google_analytics_include_tag 'your-id' %>
19
23
 
20
- (Will only show the include tag in production and test env)
24
+ (Will only show the include tag in production)
@@ -4,8 +4,8 @@ module Analytics
4
4
  module Base
5
5
 
6
6
  def google_analytics_include_tag(account)
7
- if ['production','test'].include? ::Rails.env
8
- script = <<-SCRIPT
7
+ if ::Rails.env.production?
8
+ script = <<-SCRIPT.strip_heredoc
9
9
  var _gaq = _gaq || [];
10
10
  _gaq.push(['_setAccount', '#{account}']);
11
11
  _gaq.push(['_trackPageview']);
@@ -15,7 +15,7 @@ module Analytics
15
15
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
16
16
  })();
17
17
  SCRIPT
18
- content_tag(:script, script.html_safe, type: 'text/javascript')
18
+ content_tag :script, script.html_safe, type: 'text/javascript'
19
19
  end
20
20
  end
21
21
 
@@ -1,7 +1,7 @@
1
1
  module Analytics
2
2
  module Rails
3
3
 
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
 
6
6
  end
7
7
  end
@@ -24,3 +24,55 @@ Processing by PagesController#index as HTML
24
24
  Rendered pages/index.html.erb within layouts/application (0.9ms)
25
25
  Completed 200 OK in 90ms (Views: 89.8ms | ActiveRecord: 0.0ms)
26
26
   (0.1ms) rollback transaction
27
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
28
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
29
+  (0.1ms) SELECT version FROM "schema_migrations"
30
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
31
+  (0.1ms) begin transaction
32
+ --------------------------------------------
33
+ IncludeTagTest: test_should_show_include_tag
34
+ --------------------------------------------
35
+ Started GET "/" for 127.0.0.1 at 2013-11-30 14:43:44 -0200
36
+ Processing by PagesController#index as HTML
37
+ Rendered pages/index.html.erb within layouts/application (0.9ms)
38
+ Completed 200 OK in 17ms (Views: 17.0ms | ActiveRecord: 0.0ms)
39
+  (0.1ms) rollback transaction
40
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
41
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
42
+  (0.1ms) SELECT version FROM "schema_migrations"
43
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
44
+  (0.1ms) begin transaction
45
+ --------------------------------------------
46
+ IncludeTagTest: test_should_show_include_tag
47
+ --------------------------------------------
48
+ Started GET "/" for 127.0.0.1 at 2014-03-01 15:50:39 -0200
49
+ Processing by PagesController#index as HTML
50
+ Rendered pages/index.html.erb within layouts/application (1.1ms)
51
+ Completed 200 OK in 28ms (Views: 27.6ms | ActiveRecord: 0.0ms)
52
+  (0.1ms) rollback transaction
53
+  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
54
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
55
+  (0.1ms) SELECT version FROM "schema_migrations"
56
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
57
+  (0.1ms) begin transaction
58
+ --------------------------------------------
59
+ IncludeTagTest: test_should_show_include_tag
60
+ --------------------------------------------
61
+ Started GET "/" for 127.0.0.1 at 2014-03-01 15:51:10 -0200
62
+ Processing by PagesController#index as HTML
63
+ Rendered pages/index.html.erb within layouts/application (0.9ms)
64
+ Completed 200 OK in 13ms (Views: 12.2ms | ActiveRecord: 0.0ms)
65
+  (0.1ms) rollback transaction
66
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
67
+  (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
68
+  (0.1ms) SELECT version FROM "schema_migrations"
69
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
70
+  (0.0ms) begin transaction
71
+ --------------------------------------------
72
+ IncludeTagTest: test_should_show_include_tag
73
+ --------------------------------------------
74
+ Started GET "/" for 127.0.0.1 at 2014-03-01 15:54:05 -0200
75
+ Processing by PagesController#index as HTML
76
+ Rendered pages/index.html.erb within layouts/application (0.9ms)
77
+ Completed 200 OK in 13ms (Views: 12.5ms | ActiveRecord: 0.0ms)
78
+  (0.1ms) rollback transaction
@@ -3,9 +3,20 @@ require 'test_helper'
3
3
  class IncludeTagTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  test "should show include tag" do
6
- get '/'
7
- assert_response :success
8
- assert response.body.include?("_gaq.push(['_setAccount', 'your-id']);")
6
+ with_env 'production' do
7
+ get '/'
8
+ assert_response :success
9
+ assert response.body.include?("<script type=\"text/javascript\">var _gaq = _gaq || [];\n_gaq.push(['_setAccount', 'your-id']);\n_gaq.push(['_trackPageview']);\n(function(){\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n})();\n</script>")
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def with_env(value)
16
+ old_env = Rails.env
17
+ Rails.env = value
18
+ yield
19
+ Rails.env = old_env
9
20
  end
10
21
 
11
22
  end
metadata CHANGED
@@ -1,58 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - Mattways
7
+ - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-19 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Adds a simple view helper to create the google analytics include tag.
42
42
  email:
43
- - contact@mattways.com
43
+ - hello@museways.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - MIT-LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - lib/analytics-rails.rb
52
+ - lib/analytics/rails.rb
48
53
  - lib/analytics/rails/action_view/base.rb
49
54
  - lib/analytics/rails/railtie.rb
50
55
  - lib/analytics/rails/version.rb
51
- - lib/analytics/rails.rb
52
- - lib/analytics-rails.rb
53
- - MIT-LICENSE
54
- - Rakefile
55
- - README.rdoc
56
+ - test/dummy/README.rdoc
57
+ - test/dummy/Rakefile
56
58
  - test/dummy/app/assets/javascripts/application.js
57
59
  - test/dummy/app/assets/stylesheets/application.css
58
60
  - test/dummy/app/controllers/application_controller.rb
@@ -63,6 +65,7 @@ files:
63
65
  - test/dummy/bin/bundle
64
66
  - test/dummy/bin/rails
65
67
  - test/dummy/bin/rake
68
+ - test/dummy/config.ru
66
69
  - test/dummy/config/application.rb
67
70
  - test/dummy/config/boot.rb
68
71
  - test/dummy/config/database.yml
@@ -79,7 +82,6 @@ files:
79
82
  - test/dummy/config/initializers/wrap_parameters.rb
80
83
  - test/dummy/config/locales/en.yml
81
84
  - test/dummy/config/routes.rb
82
- - test/dummy/config.ru
83
85
  - test/dummy/db/development.sqlite3
84
86
  - test/dummy/db/schema.rb
85
87
  - test/dummy/log/development.log
@@ -88,8 +90,6 @@ files:
88
90
  - test/dummy/public/422.html
89
91
  - test/dummy/public/500.html
90
92
  - test/dummy/public/favicon.ico
91
- - test/dummy/Rakefile
92
- - test/dummy/README.rdoc
93
93
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
94
94
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
95
95
  - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
@@ -98,7 +98,7 @@ files:
98
98
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
99
99
  - test/include_tag_test.rb
100
100
  - test/test_helper.rb
101
- homepage: https://github.com/mattways/analytics-rails
101
+ homepage: https://github.com/museways/analytics-rails
102
102
  licenses:
103
103
  - MIT
104
104
  metadata: {}
@@ -108,17 +108,17 @@ require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.0.3
121
+ rubygems_version: 2.2.2
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Google Analytics for Rails.