analytics-rails 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +2 -2
  3. data/Rakefile +1 -1
  4. data/lib/analytics/rails/action_view/base.rb +2 -2
  5. data/lib/analytics/rails/version.rb +1 -1
  6. data/test/dummy/app/controllers/pages_controller.rb +6 -0
  7. data/test/dummy/app/views/layouts/application.html.erb +2 -2
  8. data/test/dummy/app/views/{statics/home.html.erb → pages/index.html.erb} +0 -0
  9. data/test/dummy/config/application.rb +4 -8
  10. data/test/dummy/config/environments/development.rb +1 -4
  11. data/test/dummy/config/environments/production.rb +3 -0
  12. data/test/dummy/config/environments/test.rb +2 -5
  13. data/test/dummy/config/routes.rb +1 -1
  14. data/test/dummy/log/test.log +108 -0
  15. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/6ee31c758c2207128f3b2fb9f1e7fc1c +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/78bbdd3d4b68f961ea76c51d172aec6b +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/c7342e04b6a4ad6af1bb72c5c094c804 +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/f09692c097713119fa701a4122205808 +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  25. data/test/include_tag_test.rb +11 -0
  26. metadata +41 -26
  27. data/test/analytics_rails_test.rb +0 -9
  28. data/test/dummy/app/controllers/statics_controller.rb +0 -6
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 787378c15457dc6e32361d9cf6c8cd635e9282f2
4
+ data.tar.gz: 4a02603a0ce7573b2df54626697c09867cc7caf1
5
+ SHA512:
6
+ metadata.gz: bf8485de90b4bbcbfcf62a977ddd9b4abd97dcdc1b782de534e9f3b64ea5505a5b6f34e452b6bc4b886f144db7577e42e2c5224a0143fa7d6dcbe2fafd2932f8
7
+ data.tar.gz: 88606d8da1895562136f80cbf79e06fef0ba744151d840511231ba85596c8083ec4eed3bdb48398b6d51701f3f324e1b6b8c3080baa43cf41d66d3797d2249ea
@@ -15,6 +15,6 @@ Then bundle:
15
15
  = Usage
16
16
 
17
17
  In your layout add a line like this in your head:
18
- = google_analytics_include_tag 'your-id'
18
+ <%= google_analytics_include_tag 'your-id' %>
19
19
 
20
- (Will only show the include tag in production env)
20
+ (Will only show the include tag in production and test env)
data/Rakefile CHANGED
@@ -35,4 +35,4 @@ Rake::TestTask.new(:test) do |t|
35
35
  end
36
36
 
37
37
 
38
- task :default => :test
38
+ task default: :test
@@ -4,7 +4,7 @@ module Analytics
4
4
  module Base
5
5
 
6
6
  def google_analytics_include_tag(account)
7
- if ::Rails.env.production?
7
+ if ['production','test'].include? ::Rails.env
8
8
  script = <<-SCRIPT
9
9
  var _gaq = _gaq || [];
10
10
  _gaq.push(['_setAccount', '#{account}']);
@@ -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.4'
4
+ VERSION = '0.0.6'
5
5
 
6
6
  end
7
7
  end
@@ -0,0 +1,6 @@
1
+ class PagesController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ end
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
5
+ <%= stylesheet_link_tag 'application', media: 'all' %>
6
+ <%= javascript_include_tag 'application' %>
7
7
  <%= google_analytics_include_tag 'your-id' %>
8
8
  <%= csrf_meta_tags %>
9
9
  </head>
@@ -30,7 +30,7 @@ module Dummy
30
30
  # config.i18n.default_locale = :de
31
31
 
32
32
  # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
33
+ config.encoding = 'utf-8'
34
34
 
35
35
  # Configure sensitive parameters which will be filtered from the log file.
36
36
  config.filter_parameters += [:password]
@@ -43,17 +43,13 @@ module Dummy
43
43
  # like if you have constraints or database-specific column types
44
44
  # config.active_record.schema_format = :sql
45
45
 
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- config.active_record.whitelist_attributes = true
51
-
52
46
  # Enable the asset pipeline
53
47
  config.assets.enabled = true
54
48
 
55
49
  # Version of your assets, change this if you want to expire all your assets
56
50
  config.assets.version = '1.0'
51
+
52
+ # Rails 4 fix
53
+ config.secret_key_base = 'blipblapblup'
57
54
  end
58
55
  end
59
-
@@ -7,7 +7,7 @@ Dummy::Application.configure do
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
@@ -22,9 +22,6 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
25
  # Log the query plan for queries taking more than this (works
29
26
  # with SQLite, MySQL, and PostgreSQL)
30
27
  config.active_record.auto_explain_threshold_in_seconds = 0.5
@@ -10,6 +10,9 @@ Dummy::Application.configure do
10
10
 
11
11
  # Disable Rails's static asset server (Apache or nginx will already do this)
12
12
  config.serve_static_assets = false
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.config.eager_load = false
13
16
 
14
17
  # Compress JavaScripts and CSS
15
18
  config.assets.compress = true
@@ -9,10 +9,10 @@ Dummy::Application.configure do
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
11
  config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
12
+ config.static_cache_control = 'public, max-age=3600'
13
13
 
14
14
  # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ config.eager_load = false
16
16
 
17
17
  # Show full error reports and disable caching
18
18
  config.consider_all_requests_local = true
@@ -29,9 +29,6 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
-
35
32
  # Print deprecation notices to the stderr
36
33
  config.active_support.deprecation = :stderr
37
34
  end
@@ -1,6 +1,6 @@
1
1
  Dummy::Application.routes.draw do
2
2
 
3
- root :to => 'statics#home'
3
+ root to: 'pages#index'
4
4
 
5
5
  # The priority is based upon order of creation:
6
6
  # first created -> highest priority.
@@ -79,3 +79,111 @@ Connecting to database specified by database.yml
79
79
  Connecting to database specified by database.yml
80
80
   (0.2ms) begin transaction
81
81
   (0.0ms) rollback transaction
82
+  (0.2ms) begin transaction
83
+ ------------------------------------------------
84
+ AnalyticsRailsTest: test_should_show_include_tag
85
+ ------------------------------------------------
86
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:33:33 -0300
87
+  (0.1ms) rollback transaction
88
+  (0.2ms) begin transaction
89
+ ------------------------------------------------
90
+ AnalyticsRailsTest: test_should_show_include_tag
91
+ ------------------------------------------------
92
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:34:11 -0300
93
+ Processing by PagesController#index as HTML
94
+ Completed 500 Internal Server Error in 1ms
95
+  (0.1ms) rollback transaction
96
+  (0.2ms) begin transaction
97
+ ------------------------------------------------
98
+ AnalyticsRailsTest: test_should_show_include_tag
99
+ ------------------------------------------------
100
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:35:37 -0300
101
+ Processing by PagesController#index as HTML
102
+ Completed 500 Internal Server Error in 1ms
103
+  (0.1ms) rollback transaction
104
+  (0.2ms) begin transaction
105
+ ------------------------------------------------
106
+ AnalyticsRailsTest: test_should_show_include_tag
107
+ ------------------------------------------------
108
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:36:10 -0300
109
+ Processing by PagesController#index as HTML
110
+ Completed 500 Internal Server Error in 1ms
111
+  (0.1ms) rollback transaction
112
+  (0.2ms) begin transaction
113
+ ------------------------------------------------
114
+ AnalyticsRailsTest: test_should_show_include_tag
115
+ ------------------------------------------------
116
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:36:50 -0300
117
+ Processing by PagesController#index as HTML
118
+ Completed 500 Internal Server Error in 1ms
119
+  (0.1ms) rollback transaction
120
+  (0.2ms) begin transaction
121
+ ------------------------------------------------
122
+ AnalyticsRailsTest: test_should_show_include_tag
123
+ ------------------------------------------------
124
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:38:57 -0300
125
+ Processing by PagesController#index as HTML
126
+ Completed 500 Internal Server Error in 1ms
127
+  (0.1ms) rollback transaction
128
+  (0.2ms) begin transaction
129
+ ------------------------------------------------
130
+ AnalyticsRailsTest: test_should_show_include_tag
131
+ ------------------------------------------------
132
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:40:26 -0300
133
+ Processing by PagesController#index as HTML
134
+ Completed 500 Internal Server Error in 1ms
135
+  (0.1ms) rollback transaction
136
+  (0.2ms) begin transaction
137
+ ------------------------------------------------
138
+ AnalyticsRailsTest: test_should_show_include_tag
139
+ ------------------------------------------------
140
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:40:43 -0300
141
+ Processing by PagesController#index as HTML
142
+ Rendered pages/index.html.erb within layouts/application (0.4ms)
143
+ Completed 200 OK in 62ms (Views: 61.1ms | ActiveRecord: 0.0ms)
144
+  (0.1ms) rollback transaction
145
+  (0.2ms) begin transaction
146
+ ------------------------------------------------
147
+ AnalyticsRailsTest: test_should_show_include_tag
148
+ ------------------------------------------------
149
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:43:19 -0300
150
+ Processing by PagesController#index as HTML
151
+ Rendered pages/index.html.erb within layouts/application (1.0ms)
152
+ Completed 200 OK in 17ms (Views: 16.8ms | ActiveRecord: 0.0ms)
153
+  (0.1ms) rollback transaction
154
+  (0.2ms) begin transaction
155
+ ------------------------------------------------
156
+ AnalyticsRailsTest: test_should_show_include_tag
157
+ ------------------------------------------------
158
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:43:59 -0300
159
+ Processing by PagesController#index as HTML
160
+ Rendered pages/index.html.erb within layouts/application (0.8ms)
161
+ Completed 200 OK in 14ms (Views: 13.4ms | ActiveRecord: 0.0ms)
162
+  (0.1ms) rollback transaction
163
+  (0.2ms) begin transaction
164
+ ------------------------------------------------
165
+ AnalyticsRailsTest: test_should_show_include_tag
166
+ ------------------------------------------------
167
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:44:16 -0300
168
+ Processing by PagesController#index as HTML
169
+ Rendered pages/index.html.erb within layouts/application (0.8ms)
170
+ Completed 200 OK in 14ms (Views: 13.6ms | ActiveRecord: 0.0ms)
171
+  (0.1ms) rollback transaction
172
+  (0.2ms) begin transaction
173
+ ------------------------------------------------
174
+ AnalyticsRailsTest: test_should_show_include_tag
175
+ ------------------------------------------------
176
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:47:29 -0300
177
+ Processing by PagesController#index as HTML
178
+ Rendered pages/index.html.erb within layouts/application (0.8ms)
179
+ Completed 200 OK in 13ms (Views: 13.1ms | ActiveRecord: 0.0ms)
180
+  (0.1ms) rollback transaction
181
+  (0.2ms) begin transaction
182
+ ------------------------------------------------
183
+ AnalyticsRailsTest: test_should_show_include_tag
184
+ ------------------------------------------------
185
+ Started GET "/" for 127.0.0.1 at 2013-08-05 14:48:10 -0300
186
+ Processing by PagesController#index as HTML
187
+ Rendered pages/index.html.erb within layouts/application (0.9ms)
188
+ Completed 200 OK in 14ms (Views: 13.6ms | ActiveRecord: 0.0ms)
189
+  (0.1ms) rollback transaction
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class AnalyticsRailsTest < ActionDispatch::IntegrationTest
4
+
5
+ test "should show include tag" do
6
+ get '/'
7
+ assert_response :success, 'request fail'
8
+ assert response.body.include?("_gaq.push(['_setAccount', 'your-id']);"), 'no include tag'
9
+ end
10
+
11
+ end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mattways
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2013-08-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 3.2.8
19
+ version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 3.2.8
26
+ version: 3.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sqlite3
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: Adds a simple view helper to create the google analytics include tag.
@@ -58,14 +53,13 @@ files:
58
53
  - MIT-LICENSE
59
54
  - Rakefile
60
55
  - README.rdoc
61
- - test/analytics_rails_test.rb
62
56
  - test/dummy/app/assets/javascripts/application.js
63
57
  - test/dummy/app/assets/stylesheets/application.css
64
58
  - test/dummy/app/controllers/application_controller.rb
65
- - test/dummy/app/controllers/statics_controller.rb
59
+ - test/dummy/app/controllers/pages_controller.rb
66
60
  - test/dummy/app/helpers/application_helper.rb
67
61
  - test/dummy/app/views/layouts/application.html.erb
68
- - test/dummy/app/views/statics/home.html.erb
62
+ - test/dummy/app/views/pages/index.html.erb
69
63
  - test/dummy/config/application.rb
70
64
  - test/dummy/config/boot.rb
71
65
  - test/dummy/config/database.yml
@@ -102,40 +96,50 @@ files:
102
96
  - test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
103
97
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
104
98
  - test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
99
+ - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
100
+ - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
101
+ - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
102
+ - test/dummy/tmp/cache/assets/test/sprockets/6ee31c758c2207128f3b2fb9f1e7fc1c
103
+ - test/dummy/tmp/cache/assets/test/sprockets/78bbdd3d4b68f961ea76c51d172aec6b
104
+ - test/dummy/tmp/cache/assets/test/sprockets/c7342e04b6a4ad6af1bb72c5c094c804
105
+ - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
106
+ - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
107
+ - test/dummy/tmp/cache/assets/test/sprockets/f09692c097713119fa701a4122205808
108
+ - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
109
+ - test/include_tag_test.rb
105
110
  - test/test_helper.rb
106
111
  homepage: https://github.com/mattways/analytics-rails
107
- licenses: []
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
108
115
  post_install_message:
109
116
  rdoc_options: []
110
117
  require_paths:
111
118
  - lib
112
119
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
120
  requirements:
115
- - - ! '>='
121
+ - - '>='
116
122
  - !ruby/object:Gem::Version
117
123
  version: '0'
118
124
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
125
  requirements:
121
- - - ! '>='
126
+ - - '>='
122
127
  - !ruby/object:Gem::Version
123
128
  version: '0'
124
129
  requirements: []
125
130
  rubyforge_project:
126
- rubygems_version: 1.8.23
131
+ rubygems_version: 2.0.3
127
132
  signing_key:
128
- specification_version: 3
133
+ specification_version: 4
129
134
  summary: Google Analytics for Rails.
130
135
  test_files:
131
- - test/analytics_rails_test.rb
132
136
  - test/dummy/app/assets/javascripts/application.js
133
137
  - test/dummy/app/assets/stylesheets/application.css
134
138
  - test/dummy/app/controllers/application_controller.rb
135
- - test/dummy/app/controllers/statics_controller.rb
139
+ - test/dummy/app/controllers/pages_controller.rb
136
140
  - test/dummy/app/helpers/application_helper.rb
137
141
  - test/dummy/app/views/layouts/application.html.erb
138
- - test/dummy/app/views/statics/home.html.erb
142
+ - test/dummy/app/views/pages/index.html.erb
139
143
  - test/dummy/config/application.rb
140
144
  - test/dummy/config/boot.rb
141
145
  - test/dummy/config/database.yml
@@ -172,4 +176,15 @@ test_files:
172
176
  - test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
173
177
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
174
178
  - test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
179
+ - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
180
+ - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
181
+ - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
182
+ - test/dummy/tmp/cache/assets/test/sprockets/6ee31c758c2207128f3b2fb9f1e7fc1c
183
+ - test/dummy/tmp/cache/assets/test/sprockets/78bbdd3d4b68f961ea76c51d172aec6b
184
+ - test/dummy/tmp/cache/assets/test/sprockets/c7342e04b6a4ad6af1bb72c5c094c804
185
+ - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
186
+ - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
187
+ - test/dummy/tmp/cache/assets/test/sprockets/f09692c097713119fa701a4122205808
188
+ - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
189
+ - test/include_tag_test.rb
175
190
  - test/test_helper.rb
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AnalyticsRailsTest < ActiveSupport::TestCase
4
-
5
- test "truth" do
6
- assert_kind_of Module, Analytics::Rails
7
- end
8
-
9
- end
@@ -1,6 +0,0 @@
1
- class StaticsController < ApplicationController
2
-
3
- def home
4
- end
5
-
6
- end