analytical 3.0.6 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/analytical.gemspec +2 -2
- data/lib/analytical.rb +9 -3
- data/lib/analytical/api.rb +2 -2
- data/lib/analytical/modules/clicky.rb +1 -1
- data/spec/analytical/api_spec.rb +10 -0
- data/spec/analytical/modules/clicky_spec.rb +0 -6
- data/spec/analytical_spec.rb +10 -0
- data/spec/config/analytical.yml +4 -0
- metadata +60 -60
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.7
|
data/analytical.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{analytical}
|
8
|
-
s.version = "3.0.
|
8
|
+
s.version = "3.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Krall", "Nathan Phelps", "Adam Anderson", "Kevin Menard", "Ablyamitov Ablyamit", "Kurt Werle", "Olivier Lauzon", "Daniel Doubrovkine"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-09}
|
13
13
|
s.description = %q{Gem for managing multiple analytics services in your rails app.}
|
14
14
|
s.email = %q{josh@feefighters.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/analytical.rb
CHANGED
@@ -15,8 +15,14 @@ module Analytical
|
|
15
15
|
env = (::Rails.env || :production).to_sym
|
16
16
|
file_options = file_options[env] if file_options.has_key?(env)
|
17
17
|
file_options.each do |k, v|
|
18
|
-
|
19
|
-
|
18
|
+
if v.respond_to?(:symbolize_keys)
|
19
|
+
# module configuration
|
20
|
+
config_options[k.to_sym] = v.symbolize_keys
|
21
|
+
config_options[:modules] << k.to_sym unless options && options[:modules]
|
22
|
+
else
|
23
|
+
# regular option
|
24
|
+
config_options[k.to_sym] = v
|
25
|
+
end
|
20
26
|
end if file_options
|
21
27
|
end if File.exists?("#{::Rails.root}/config/analytical.yml")
|
22
28
|
|
@@ -38,7 +44,7 @@ module Analytical
|
|
38
44
|
options[:modules] = []
|
39
45
|
end
|
40
46
|
options[:modules] = options[:filter_modules].call(self, options[:modules]) if options[:filter_modules]
|
41
|
-
options[:javascript_helpers] ||= true
|
47
|
+
options[:javascript_helpers] ||= true if options[:javascript_helpers].nil?
|
42
48
|
Analytical::Api.new options
|
43
49
|
end
|
44
50
|
end
|
data/lib/analytical/api.rb
CHANGED
@@ -76,7 +76,7 @@ module Analytical
|
|
76
76
|
if ::Rails::VERSION::MAJOR >= 3 && ::Rails::VERSION::MINOR >= 1 # Rails 3.1 lets us override views in engines
|
77
77
|
js << options[:controller].send(:render_to_string, :partial=>'analytical_javascript') if options[:controller]
|
78
78
|
else # All other rails
|
79
|
-
_partial_path = Pathname.new(__FILE__).dirname.join('..', '..', 'app/views/application', '
|
79
|
+
_partial_path = Pathname.new(__FILE__).dirname.join('..', '..', 'app/views/application', '_analytical_javascript.html.erb').to_s
|
80
80
|
js << options[:controller].send(:render_to_string, :partial=>_partial_path) if options[:controller]
|
81
81
|
end
|
82
82
|
end
|
@@ -128,4 +128,4 @@ module Analytical
|
|
128
128
|
|
129
129
|
end
|
130
130
|
|
131
|
-
end
|
131
|
+
end
|
data/spec/analytical/api_spec.rb
CHANGED
@@ -111,6 +111,16 @@ describe "Analytical::Api" do
|
|
111
111
|
@google.should_receive(:init_javascript).with(:head_append).and_return('google_a')
|
112
112
|
@api.head_append_javascript.should == "console_agoogle_a"
|
113
113
|
end
|
114
|
+
it 'should render an existing template for Rails 3.0' do
|
115
|
+
@api.options[:javascript_helpers] = true
|
116
|
+
(@api.options[:controller] ||= Object.new).stub!(:render_to_string) { |param| param[:partial] }
|
117
|
+
File.exist?(@api.head_append_javascript).should be_true
|
118
|
+
end
|
119
|
+
it 'should not render an existing template if javascript_helpers is false' do
|
120
|
+
@api.options[:javascript_helpers] = false
|
121
|
+
(@api.options[:controller] ||= Object.new).should_not_receive(:render_to_string)
|
122
|
+
@api.head_append_javascript.should be_blank
|
123
|
+
end
|
114
124
|
end
|
115
125
|
|
116
126
|
describe '#body_prepend_javascript' do
|
@@ -35,12 +35,6 @@ describe "Analytical::Modules::Clicky" do
|
|
35
35
|
@api.init_javascript(:body_append).should =~ /static.getclicky.com\/js/
|
36
36
|
@api.init_javascript(:body_append).should =~ /abcdef/
|
37
37
|
end
|
38
|
-
describe 'for an ssl connection' do
|
39
|
-
it 'should return the ssl init code' do
|
40
|
-
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef', :ssl=>true
|
41
|
-
@api.init_javascript(:body_append).should =~ /https/
|
42
|
-
end
|
43
|
-
end
|
44
38
|
describe 'with an identify command queued' do
|
45
39
|
@api = Analytical::Modules::Clicky.new :parent=>@parent, :key=>'abcdef'
|
46
40
|
@api.queue :identify, 'user id', {:email=>'someone@test.com'}
|
data/spec/analytical_spec.rb
CHANGED
@@ -25,6 +25,16 @@ describe "Analytical" do
|
|
25
25
|
DummyForInit.analytical
|
26
26
|
d = DummyForInit.new.analytical
|
27
27
|
d.options[:modules].sort_by { |m| m.to_s }.should == [:chartbeat, :clicky, :google, :kiss_metrics]
|
28
|
+
d.options[:true_option].should be_true
|
29
|
+
d.options[:false_option].should be_false
|
30
|
+
d.options[:string_option].should == "string"
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should preserve :javascript_helpers option' do
|
34
|
+
options = { :javascript_helpers => false, :modules => [] }
|
35
|
+
DummyForInit.analytical options
|
36
|
+
a = DummyForInit.new.analytical
|
37
|
+
a.options[:javascript_helpers].should be_false
|
28
38
|
end
|
29
39
|
|
30
40
|
it 'should use the supplied options' do
|
data/spec/config/analytical.yml
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 7
|
10
|
+
version: 3.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Krall
|
@@ -22,11 +22,13 @@ autorequire:
|
|
22
22
|
bindir: bin
|
23
23
|
cert_chain: []
|
24
24
|
|
25
|
-
date: 2011-
|
25
|
+
date: 2011-09-09 00:00:00 -05:00
|
26
26
|
default_executable:
|
27
27
|
dependencies:
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
|
29
|
+
prerelease: false
|
30
|
+
type: :development
|
31
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
30
32
|
none: false
|
31
33
|
requirements:
|
32
34
|
- - "="
|
@@ -37,12 +39,12 @@ dependencies:
|
|
37
39
|
- 0
|
38
40
|
- 9
|
39
41
|
version: 3.0.9
|
40
|
-
|
41
|
-
type: :development
|
42
|
-
prerelease: false
|
42
|
+
version_requirements: *id001
|
43
43
|
name: rails
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
|
45
|
+
prerelease: false
|
46
|
+
type: :development
|
47
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
46
48
|
none: false
|
47
49
|
requirements:
|
48
50
|
- - ">="
|
@@ -51,12 +53,12 @@ dependencies:
|
|
51
53
|
segments:
|
52
54
|
- 0
|
53
55
|
version: "0"
|
54
|
-
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
56
|
+
version_requirements: *id002
|
57
57
|
name: activesupport
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
|
59
|
+
prerelease: false
|
60
|
+
type: :development
|
61
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
60
62
|
none: false
|
61
63
|
requirements:
|
62
64
|
- - ">="
|
@@ -65,12 +67,12 @@ dependencies:
|
|
65
67
|
segments:
|
66
68
|
- 0
|
67
69
|
version: "0"
|
68
|
-
|
69
|
-
type: :development
|
70
|
-
prerelease: false
|
70
|
+
version_requirements: *id003
|
71
71
|
name: activemodel
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
|
73
|
+
prerelease: false
|
74
|
+
type: :development
|
75
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
76
|
none: false
|
75
77
|
requirements:
|
76
78
|
- - "="
|
@@ -81,12 +83,12 @@ dependencies:
|
|
81
83
|
- 6
|
82
84
|
- 0
|
83
85
|
version: 2.6.0
|
84
|
-
|
85
|
-
type: :development
|
86
|
-
prerelease: false
|
86
|
+
version_requirements: *id004
|
87
87
|
name: rspec
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
|
-
|
89
|
+
prerelease: false
|
90
|
+
type: :development
|
91
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
92
|
none: false
|
91
93
|
requirements:
|
92
94
|
- - "="
|
@@ -97,12 +99,12 @@ dependencies:
|
|
97
99
|
- 6
|
98
100
|
- 4
|
99
101
|
version: 2.6.4
|
100
|
-
|
101
|
-
type: :development
|
102
|
-
prerelease: false
|
102
|
+
version_requirements: *id005
|
103
103
|
name: rspec-core
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
|
105
|
+
prerelease: false
|
106
|
+
type: :development
|
107
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
106
108
|
none: false
|
107
109
|
requirements:
|
108
110
|
- - "="
|
@@ -113,12 +115,12 @@ dependencies:
|
|
113
115
|
- 6
|
114
116
|
- 0
|
115
117
|
version: 2.6.0
|
116
|
-
|
117
|
-
type: :development
|
118
|
-
prerelease: false
|
118
|
+
version_requirements: *id006
|
119
119
|
name: rspec-expectations
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
|
-
|
121
|
+
prerelease: false
|
122
|
+
type: :development
|
123
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
122
124
|
none: false
|
123
125
|
requirements:
|
124
126
|
- - "="
|
@@ -129,12 +131,12 @@ dependencies:
|
|
129
131
|
- 6
|
130
132
|
- 0
|
131
133
|
version: 2.6.0
|
132
|
-
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
134
|
+
version_requirements: *id007
|
135
135
|
name: rspec-mocks
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
|
-
|
137
|
+
prerelease: false
|
138
|
+
type: :development
|
139
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
138
140
|
none: false
|
139
141
|
requirements:
|
140
142
|
- - "="
|
@@ -145,12 +147,12 @@ dependencies:
|
|
145
147
|
- 6
|
146
148
|
- 0
|
147
149
|
version: 2.6.0
|
148
|
-
|
149
|
-
type: :development
|
150
|
-
prerelease: false
|
150
|
+
version_requirements: *id008
|
151
151
|
name: rspec-rails
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
|
-
|
153
|
+
prerelease: false
|
154
|
+
type: :development
|
155
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
154
156
|
none: false
|
155
157
|
requirements:
|
156
158
|
- - ">="
|
@@ -159,12 +161,12 @@ dependencies:
|
|
159
161
|
segments:
|
160
162
|
- 0
|
161
163
|
version: "0"
|
162
|
-
|
163
|
-
type: :development
|
164
|
-
prerelease: false
|
164
|
+
version_requirements: *id009
|
165
165
|
name: jeweler
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
|
-
|
167
|
+
prerelease: false
|
168
|
+
type: :development
|
169
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
168
170
|
none: false
|
169
171
|
requirements:
|
170
172
|
- - ">="
|
@@ -173,12 +175,12 @@ dependencies:
|
|
173
175
|
segments:
|
174
176
|
- 0
|
175
177
|
version: "0"
|
176
|
-
|
177
|
-
type: :development
|
178
|
-
prerelease: false
|
178
|
+
version_requirements: *id010
|
179
179
|
name: diff-lcs
|
180
180
|
- !ruby/object:Gem::Dependency
|
181
|
-
|
181
|
+
prerelease: false
|
182
|
+
type: :development
|
183
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
182
184
|
none: false
|
183
185
|
requirements:
|
184
186
|
- - ">="
|
@@ -187,12 +189,12 @@ dependencies:
|
|
187
189
|
segments:
|
188
190
|
- 0
|
189
191
|
version: "0"
|
190
|
-
|
191
|
-
type: :development
|
192
|
-
prerelease: false
|
192
|
+
version_requirements: *id011
|
193
193
|
name: guard
|
194
194
|
- !ruby/object:Gem::Dependency
|
195
|
-
|
195
|
+
prerelease: false
|
196
|
+
type: :development
|
197
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
196
198
|
none: false
|
197
199
|
requirements:
|
198
200
|
- - ">="
|
@@ -201,12 +203,12 @@ dependencies:
|
|
201
203
|
segments:
|
202
204
|
- 0
|
203
205
|
version: "0"
|
204
|
-
|
205
|
-
type: :development
|
206
|
-
prerelease: false
|
206
|
+
version_requirements: *id012
|
207
207
|
name: guard-rspec
|
208
208
|
- !ruby/object:Gem::Dependency
|
209
|
-
|
209
|
+
prerelease: false
|
210
|
+
type: :development
|
211
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
210
212
|
none: false
|
211
213
|
requirements:
|
212
214
|
- - ">="
|
@@ -215,12 +217,12 @@ dependencies:
|
|
215
217
|
segments:
|
216
218
|
- 0
|
217
219
|
version: "0"
|
218
|
-
|
219
|
-
type: :development
|
220
|
-
prerelease: false
|
220
|
+
version_requirements: *id013
|
221
221
|
name: rb-fsevent
|
222
222
|
- !ruby/object:Gem::Dependency
|
223
|
-
|
223
|
+
prerelease: false
|
224
|
+
type: :development
|
225
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
224
226
|
none: false
|
225
227
|
requirements:
|
226
228
|
- - ">="
|
@@ -229,9 +231,7 @@ dependencies:
|
|
229
231
|
segments:
|
230
232
|
- 0
|
231
233
|
version: "0"
|
232
|
-
|
233
|
-
type: :development
|
234
|
-
prerelease: false
|
234
|
+
version_requirements: *id014
|
235
235
|
name: growl
|
236
236
|
description: Gem for managing multiple analytics services in your rails app.
|
237
237
|
email: josh@feefighters.com
|