gsiener-analytical 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +56 -0
- data/Guardfile +8 -0
- data/LICENSE +20 -0
- data/README.rdoc +117 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/analytical.gemspec +183 -0
- data/example/.gitignore +4 -0
- data/example/Gemfile +27 -0
- data/example/Gemfile.lock +80 -0
- data/example/README +244 -0
- data/example/Rakefile +10 -0
- data/example/app/controllers/application_controller.rb +6 -0
- data/example/app/controllers/page_controller.rb +18 -0
- data/example/app/helpers/application_helper.rb +2 -0
- data/example/app/helpers/page_helper.rb +2 -0
- data/example/app/views/layouts/application.html.erb +17 -0
- data/example/app/views/page/index.html.erb +6 -0
- data/example/app/views/page/test_a.html.erb +11 -0
- data/example/app/views/page/test_b.html.erb +7 -0
- data/example/config/analytical.yml +30 -0
- data/example/config/application.rb +46 -0
- data/example/config/boot.rb +6 -0
- data/example/config/database.yml +22 -0
- data/example/config/environment.rb +7 -0
- data/example/config/environments/development.rb +21 -0
- data/example/config/environments/production.rb +42 -0
- data/example/config/environments/test.rb +32 -0
- data/example/config/initializers/backtrace_silencers.rb +7 -0
- data/example/config/initializers/inflections.rb +10 -0
- data/example/config/initializers/mime_types.rb +5 -0
- data/example/config/initializers/secret_token.rb +7 -0
- data/example/config/initializers/session_store.rb +8 -0
- data/example/config/locales/en.yml +5 -0
- data/example/config/routes.rb +63 -0
- data/example/config.ru +4 -0
- data/example/db/seeds.rb +7 -0
- data/example/doc/README_FOR_APP +2 -0
- data/example/lib/tasks/.gitkeep +0 -0
- data/example/public/404.html +26 -0
- data/example/public/422.html +26 -0
- data/example/public/500.html +26 -0
- data/example/public/favicon.ico +0 -0
- data/example/public/images/rails.png +0 -0
- data/example/public/javascripts/application.js +2 -0
- data/example/public/javascripts/controls.js +965 -0
- data/example/public/javascripts/dragdrop.js +974 -0
- data/example/public/javascripts/effects.js +1123 -0
- data/example/public/javascripts/prototype.js +4874 -0
- data/example/public/javascripts/rails.js +118 -0
- data/example/public/robots.txt +5 -0
- data/example/public/stylesheets/.gitkeep +0 -0
- data/example/script/rails +9 -0
- data/example/test/functional/page_controller_test.rb +19 -0
- data/example/test/performance/browsing_test.rb +9 -0
- data/example/test/test_helper.rb +13 -0
- data/example/test/unit/helpers/page_helper_test.rb +4 -0
- data/example/vendor/plugins/.gitkeep +0 -0
- data/gsiener-analytical.gemspec +167 -0
- data/lib/analytical/api.rb +117 -0
- data/lib/analytical/bot_detector.rb +46 -0
- data/lib/analytical/command_store.rb +19 -0
- data/lib/analytical/modules/adroll.rb +38 -0
- data/lib/analytical/modules/adwords.rb +80 -0
- data/lib/analytical/modules/base.rb +83 -0
- data/lib/analytical/modules/chartbeat.rb +49 -0
- data/lib/analytical/modules/click_tale.rb +47 -0
- data/lib/analytical/modules/clicky.rb +49 -0
- data/lib/analytical/modules/comscore.rb +25 -0
- data/lib/analytical/modules/console.rb +82 -0
- data/lib/analytical/modules/crazy_egg.rb +24 -0
- data/lib/analytical/modules/google.rb +44 -0
- data/lib/analytical/modules/google_optimizer.rb +62 -0
- data/lib/analytical/modules/hubspot.rb +28 -0
- data/lib/analytical/modules/kiss_metrics.rb +54 -0
- data/lib/analytical/modules/loopfuse.rb +30 -0
- data/lib/analytical/modules/microsoft_ads.rb +58 -0
- data/lib/analytical/modules/mixpanel.rb +56 -0
- data/lib/analytical/modules/optimizely.rb +23 -0
- data/lib/analytical/modules/performancing.rb +34 -0
- data/lib/analytical/modules/quantcast.rb +49 -0
- data/lib/analytical/modules/reinvigorate.rb +48 -0
- data/lib/analytical/modules/totango.rb +49 -0
- data/lib/analytical/session_command_store.rb +39 -0
- data/lib/analytical.rb +56 -0
- data/rails/init.rb +1 -0
- data/spec/analytical/api_spec.rb +157 -0
- data/spec/analytical/bot_detector_spec.rb +24 -0
- data/spec/analytical/command_store_spec.rb +36 -0
- data/spec/analytical/modules/adroll_spec.rb +27 -0
- data/spec/analytical/modules/adwords_spec.rb +76 -0
- data/spec/analytical/modules/base_spec.rb +138 -0
- data/spec/analytical/modules/chartbeat_spec.rb +26 -0
- data/spec/analytical/modules/clicky_spec.rb +50 -0
- data/spec/analytical/modules/comscore_spec.rb +27 -0
- data/spec/analytical/modules/google_spec.rb +45 -0
- data/spec/analytical/modules/kiss_metrics_spec.rb +51 -0
- data/spec/analytical/modules/mixpanel_spec.rb +71 -0
- data/spec/analytical/modules/optimizely_spec.rb +26 -0
- data/spec/analytical/modules/quantcast.rb +26 -0
- data/spec/analytical/modules/reinvigorate_spec.rb +35 -0
- data/spec/analytical/session_command_store_spec.rb +50 -0
- data/spec/analytical_spec.rb +79 -0
- data/spec/config/analytical.yml +9 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +19 -0
- metadata +294 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe "Analytical" do
|
5
|
+
before(:each) do
|
6
|
+
rails_env = mock('rails environment', :'production?'=>true, :'development?'=>false)
|
7
|
+
Rails.stub!(:env).and_return(rails_env)
|
8
|
+
File.stub!(:'exists?').and_return(false)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'on initialization' do
|
12
|
+
class DummyForInit
|
13
|
+
extend Analytical
|
14
|
+
def self.helper_method(*a); end
|
15
|
+
def request
|
16
|
+
Spec::Mocks::Mock.new 'request',
|
17
|
+
:'ssl?'=>true,
|
18
|
+
:user_agent=>'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should have the default options' do
|
23
|
+
DummyForInit.analytical
|
24
|
+
d = DummyForInit.new.analytical
|
25
|
+
d.options[:modules].should == []
|
26
|
+
d.options[:development_modules].should == [:console]
|
27
|
+
d.options[:disable_if].call.should be_false
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should use the supplied options' do
|
31
|
+
DummyForInit.analytical :modules=>[:google]
|
32
|
+
d = DummyForInit.new.analytical
|
33
|
+
d.options[:modules].should == [:google]
|
34
|
+
d.options[:development_modules].should == [:console]
|
35
|
+
d.options[:disable_if].call.should be_false
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'with a robot request' do
|
39
|
+
it 'should set the modules to []' do
|
40
|
+
DummyForInit.analytical
|
41
|
+
d = DummyForInit.new
|
42
|
+
d.stub!(:'analytical_is_robot?').and_return(true)
|
43
|
+
d.analytical.options[:modules].should == []
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should open the initialization file' do
|
48
|
+
File.should_receive(:'exists?').with("#{Rails.root}/config/analytical.yml").and_return(true)
|
49
|
+
DummyForInit.analytical
|
50
|
+
DummyForInit.analytical_options[:google].should == {:key=>'google_12345'}
|
51
|
+
DummyForInit.analytical_options[:kiss_metrics].should == {:key=>'kiss_metrics_12345'}
|
52
|
+
DummyForInit.analytical_options[:clicky].should == {:key=>'clicky_12345'}
|
53
|
+
DummyForInit.analytical_options[:chartbeat].should == {:key=>'chartbeat_12345', :domain => 'your.domain.com'}
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'in production mode' do
|
57
|
+
before(:each) do
|
58
|
+
Rails.env.stub!(:production?).and_return(true)
|
59
|
+
end
|
60
|
+
it 'should start with no modules' do
|
61
|
+
Analytical::Api.should_not_receive(:include)
|
62
|
+
DummyForInit.analytical
|
63
|
+
DummyForInit.new.analytical.options[:modules] = []
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'in development mode' do
|
68
|
+
before(:each) do
|
69
|
+
Rails.env.stub!(:production?).and_return(false)
|
70
|
+
end
|
71
|
+
it 'should start with no modules' do
|
72
|
+
DummyForInit.analytical
|
73
|
+
DummyForInit.new.analytical.options[:modules] = [:console]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require 'active_support/json'
|
6
|
+
require 'action_view'
|
7
|
+
require 'spec'
|
8
|
+
require 'spec/autorun'
|
9
|
+
|
10
|
+
require 'analytical'
|
11
|
+
|
12
|
+
Spec::Runner.configure do |config|
|
13
|
+
end
|
14
|
+
|
15
|
+
module Rails
|
16
|
+
def self.root
|
17
|
+
File.dirname(__FILE__)
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,294 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gsiener-analytical
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 39
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 10
|
9
|
+
- 0
|
10
|
+
version: 2.10.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Joshua Krall
|
14
|
+
- Nathan Phelps
|
15
|
+
- Adam Anderson
|
16
|
+
- Kevin Menard
|
17
|
+
- Ablyamitov Ablyamit
|
18
|
+
- Kurt Werle
|
19
|
+
- Olivier Lauzon
|
20
|
+
autorequire:
|
21
|
+
bindir: bin
|
22
|
+
cert_chain: []
|
23
|
+
|
24
|
+
date: 2011-06-24 00:00:00 -04:00
|
25
|
+
default_executable:
|
26
|
+
dependencies:
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
type: :development
|
29
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
hash: 3
|
35
|
+
segments:
|
36
|
+
- 0
|
37
|
+
version: "0"
|
38
|
+
name: jeweler
|
39
|
+
version_requirements: *id001
|
40
|
+
prerelease: false
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
type: :development
|
43
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - "="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 9
|
49
|
+
segments:
|
50
|
+
- 1
|
51
|
+
- 3
|
52
|
+
version: "1.3"
|
53
|
+
name: rspec
|
54
|
+
version_requirements: *id002
|
55
|
+
prerelease: false
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
type: :development
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
name: diff-lcs
|
68
|
+
version_requirements: *id003
|
69
|
+
prerelease: false
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
type: :development
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 5
|
78
|
+
segments:
|
79
|
+
- 2
|
80
|
+
- 3
|
81
|
+
version: "2.3"
|
82
|
+
name: rails
|
83
|
+
version_requirements: *id004
|
84
|
+
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
type: :development
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
name: guard
|
97
|
+
version_requirements: *id005
|
98
|
+
prerelease: false
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
type: :development
|
101
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
name: guard-rspec
|
111
|
+
version_requirements: *id006
|
112
|
+
prerelease: false
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
type: :development
|
115
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
name: rb-fsevent
|
125
|
+
version_requirements: *id007
|
126
|
+
prerelease: false
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
type: :development
|
129
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
hash: 3
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
version: "0"
|
138
|
+
name: growl
|
139
|
+
version_requirements: *id008
|
140
|
+
prerelease: false
|
141
|
+
description: Gem for managing multiple analytics services in your rails app.
|
142
|
+
email: josh@feefighters.com
|
143
|
+
executables: []
|
144
|
+
|
145
|
+
extensions: []
|
146
|
+
|
147
|
+
extra_rdoc_files:
|
148
|
+
- LICENSE
|
149
|
+
- README.rdoc
|
150
|
+
files:
|
151
|
+
- .document
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- Guardfile
|
155
|
+
- LICENSE
|
156
|
+
- README.rdoc
|
157
|
+
- Rakefile
|
158
|
+
- VERSION
|
159
|
+
- analytical.gemspec
|
160
|
+
- example/.gitignore
|
161
|
+
- example/Gemfile
|
162
|
+
- example/Gemfile.lock
|
163
|
+
- example/README
|
164
|
+
- example/Rakefile
|
165
|
+
- example/app/controllers/application_controller.rb
|
166
|
+
- example/app/controllers/page_controller.rb
|
167
|
+
- example/app/helpers/application_helper.rb
|
168
|
+
- example/app/helpers/page_helper.rb
|
169
|
+
- example/app/views/layouts/application.html.erb
|
170
|
+
- example/app/views/page/index.html.erb
|
171
|
+
- example/app/views/page/test_a.html.erb
|
172
|
+
- example/app/views/page/test_b.html.erb
|
173
|
+
- example/config.ru
|
174
|
+
- example/config/analytical.yml
|
175
|
+
- example/config/application.rb
|
176
|
+
- example/config/boot.rb
|
177
|
+
- example/config/database.yml
|
178
|
+
- example/config/environment.rb
|
179
|
+
- example/config/environments/development.rb
|
180
|
+
- example/config/environments/production.rb
|
181
|
+
- example/config/environments/test.rb
|
182
|
+
- example/config/initializers/backtrace_silencers.rb
|
183
|
+
- example/config/initializers/inflections.rb
|
184
|
+
- example/config/initializers/mime_types.rb
|
185
|
+
- example/config/initializers/secret_token.rb
|
186
|
+
- example/config/initializers/session_store.rb
|
187
|
+
- example/config/locales/en.yml
|
188
|
+
- example/config/routes.rb
|
189
|
+
- example/db/seeds.rb
|
190
|
+
- example/doc/README_FOR_APP
|
191
|
+
- example/lib/tasks/.gitkeep
|
192
|
+
- example/public/404.html
|
193
|
+
- example/public/422.html
|
194
|
+
- example/public/500.html
|
195
|
+
- example/public/favicon.ico
|
196
|
+
- example/public/images/rails.png
|
197
|
+
- example/public/javascripts/application.js
|
198
|
+
- example/public/javascripts/controls.js
|
199
|
+
- example/public/javascripts/dragdrop.js
|
200
|
+
- example/public/javascripts/effects.js
|
201
|
+
- example/public/javascripts/prototype.js
|
202
|
+
- example/public/javascripts/rails.js
|
203
|
+
- example/public/robots.txt
|
204
|
+
- example/public/stylesheets/.gitkeep
|
205
|
+
- example/script/rails
|
206
|
+
- example/test/functional/page_controller_test.rb
|
207
|
+
- example/test/performance/browsing_test.rb
|
208
|
+
- example/test/test_helper.rb
|
209
|
+
- example/test/unit/helpers/page_helper_test.rb
|
210
|
+
- example/vendor/plugins/.gitkeep
|
211
|
+
- gsiener-analytical.gemspec
|
212
|
+
- lib/analytical.rb
|
213
|
+
- lib/analytical/api.rb
|
214
|
+
- lib/analytical/bot_detector.rb
|
215
|
+
- lib/analytical/command_store.rb
|
216
|
+
- lib/analytical/modules/adroll.rb
|
217
|
+
- lib/analytical/modules/adwords.rb
|
218
|
+
- lib/analytical/modules/base.rb
|
219
|
+
- lib/analytical/modules/chartbeat.rb
|
220
|
+
- lib/analytical/modules/click_tale.rb
|
221
|
+
- lib/analytical/modules/clicky.rb
|
222
|
+
- lib/analytical/modules/comscore.rb
|
223
|
+
- lib/analytical/modules/console.rb
|
224
|
+
- lib/analytical/modules/crazy_egg.rb
|
225
|
+
- lib/analytical/modules/google.rb
|
226
|
+
- lib/analytical/modules/google_optimizer.rb
|
227
|
+
- lib/analytical/modules/hubspot.rb
|
228
|
+
- lib/analytical/modules/kiss_metrics.rb
|
229
|
+
- lib/analytical/modules/loopfuse.rb
|
230
|
+
- lib/analytical/modules/microsoft_ads.rb
|
231
|
+
- lib/analytical/modules/mixpanel.rb
|
232
|
+
- lib/analytical/modules/optimizely.rb
|
233
|
+
- lib/analytical/modules/performancing.rb
|
234
|
+
- lib/analytical/modules/quantcast.rb
|
235
|
+
- lib/analytical/modules/reinvigorate.rb
|
236
|
+
- lib/analytical/modules/totango.rb
|
237
|
+
- lib/analytical/session_command_store.rb
|
238
|
+
- rails/init.rb
|
239
|
+
- spec/analytical/api_spec.rb
|
240
|
+
- spec/analytical/bot_detector_spec.rb
|
241
|
+
- spec/analytical/command_store_spec.rb
|
242
|
+
- spec/analytical/modules/adroll_spec.rb
|
243
|
+
- spec/analytical/modules/adwords_spec.rb
|
244
|
+
- spec/analytical/modules/base_spec.rb
|
245
|
+
- spec/analytical/modules/chartbeat_spec.rb
|
246
|
+
- spec/analytical/modules/clicky_spec.rb
|
247
|
+
- spec/analytical/modules/comscore_spec.rb
|
248
|
+
- spec/analytical/modules/google_spec.rb
|
249
|
+
- spec/analytical/modules/kiss_metrics_spec.rb
|
250
|
+
- spec/analytical/modules/mixpanel_spec.rb
|
251
|
+
- spec/analytical/modules/optimizely_spec.rb
|
252
|
+
- spec/analytical/modules/quantcast.rb
|
253
|
+
- spec/analytical/modules/reinvigorate_spec.rb
|
254
|
+
- spec/analytical/session_command_store_spec.rb
|
255
|
+
- spec/analytical_spec.rb
|
256
|
+
- spec/config/analytical.yml
|
257
|
+
- spec/spec.opts
|
258
|
+
- spec/spec_helper.rb
|
259
|
+
has_rdoc: true
|
260
|
+
homepage: http://github.com/gsiener/analytical
|
261
|
+
licenses: []
|
262
|
+
|
263
|
+
post_install_message:
|
264
|
+
rdoc_options: []
|
265
|
+
|
266
|
+
require_paths:
|
267
|
+
- lib
|
268
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
269
|
+
none: false
|
270
|
+
requirements:
|
271
|
+
- - ">="
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
hash: 3
|
274
|
+
segments:
|
275
|
+
- 0
|
276
|
+
version: "0"
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
278
|
+
none: false
|
279
|
+
requirements:
|
280
|
+
- - ">="
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
hash: 3
|
283
|
+
segments:
|
284
|
+
- 0
|
285
|
+
version: "0"
|
286
|
+
requirements: []
|
287
|
+
|
288
|
+
rubyforge_project:
|
289
|
+
rubygems_version: 1.5.3
|
290
|
+
signing_key:
|
291
|
+
specification_version: 3
|
292
|
+
summary: Gem for managing multiple analytics services in your rails app.
|
293
|
+
test_files: []
|
294
|
+
|