analytical 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/analytical.gemspec +124 -0
- data/example/.gitignore +4 -0
- data/example/Gemfile +27 -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 +11 -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 +5 -0
- data/example/app/views/page/test_a.html.erb +10 -0
- data/example/app/views/page/test_b.html.erb +6 -0
- data/example/config.ru +4 -0
- data/example/config/analytical.yml +6 -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 +5 -0
- data/example/config/environments/development.rb +19 -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 +64 -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/lib/analytical.rb +52 -0
- data/lib/analytical/api.rb +90 -0
- data/lib/analytical/base.rb +34 -0
- data/lib/analytical/clicky.rb +51 -0
- data/lib/analytical/console.rb +37 -0
- data/lib/analytical/google.rb +34 -0
- data/lib/analytical/kiss_metrics.rb +35 -0
- data/rails/init.rb +1 -0
- data/spec/analytical/api_spec.rb +122 -0
- data/spec/analytical/clicky_spec.rb +49 -0
- data/spec/analytical/google_spec.rb +38 -0
- data/spec/analytical/kiss_metrics_spec.rb +44 -0
- data/spec/analytical_spec.rb +64 -0
- data/spec/config/analytical.yml +6 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +22 -0
- metadata +165 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module Analytical
|
2
|
+
module Google
|
3
|
+
class Api
|
4
|
+
include Analytical::Base::Api
|
5
|
+
|
6
|
+
def initialize(parent, options={})
|
7
|
+
super
|
8
|
+
@tracking_command_location = :body_prepend
|
9
|
+
end
|
10
|
+
|
11
|
+
def init_javascript(location)
|
12
|
+
return '' unless location==:body_prepend
|
13
|
+
js = <<-HTML
|
14
|
+
<!-- Analytical Init: Google -->
|
15
|
+
<script type="text/javascript">
|
16
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
17
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
18
|
+
</script>
|
19
|
+
<script type="text/javascript">
|
20
|
+
var googleAnalyticsTracker = _gat._getTracker("#{options[:key]}");
|
21
|
+
googleAnalyticsTracker._initData();
|
22
|
+
googleAnalyticsTracker._trackPageview();
|
23
|
+
</script>
|
24
|
+
HTML
|
25
|
+
js
|
26
|
+
end
|
27
|
+
|
28
|
+
def track(*args)
|
29
|
+
"googleAnalyticsTracker._trackPageview(\"#{args.first}\");"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Analytical
|
2
|
+
module KissMetrics
|
3
|
+
class Api
|
4
|
+
include Analytical::Base::Api
|
5
|
+
|
6
|
+
def initialize(parent, options={})
|
7
|
+
super
|
8
|
+
@tracking_command_location = :body_prepend
|
9
|
+
end
|
10
|
+
|
11
|
+
def init_javascript(location)
|
12
|
+
return '' unless location==:body_prepend
|
13
|
+
js = <<-HTML
|
14
|
+
<!-- Analytical Init: KissMetrics -->
|
15
|
+
<script type="text/javascript">
|
16
|
+
var _kmq = _kmq || [];
|
17
|
+
(function(){function _kms(u,d){if(navigator.appName.indexOf("Microsoft")==0 && d)document.write("<scr"+"ipt defer='defer' async='true' src='"+u+"'></scr"+"ipt>");else{var s=document.createElement('script');s.type='text/javascript';s.async=true;s.src=u;(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);}}_kms('https://i.kissmetrics.com/i.js');_kms('http'+('https:'==document.location.protocol ? 's://s3.amazonaws.com/' : '://')+'scripts.kissmetrics.com/#{options[:key]}.1.js',1);})();
|
18
|
+
</script>
|
19
|
+
HTML
|
20
|
+
js
|
21
|
+
end
|
22
|
+
|
23
|
+
def identify(id, *args)
|
24
|
+
data = args.first
|
25
|
+
"_kmq.push([\"identify\", \"#{data[:email]}\"]);"
|
26
|
+
end
|
27
|
+
|
28
|
+
def event(name, *args)
|
29
|
+
data = args.first
|
30
|
+
"_kmq.push([\"record\", \"#{name}\", #{data.to_json}]);"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'analytical'
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Analytical::Api" do
|
4
|
+
|
5
|
+
describe 'on initialization' do
|
6
|
+
it 'should construct an api class for each module' do
|
7
|
+
Analytical::Console::Api.should_receive(:new).and_return(@console = mock('console'))
|
8
|
+
Analytical::Google::Api.should_receive(:new).and_return(@google = mock('google'))
|
9
|
+
a = Analytical::Api.new :modules=>[:console, :google]
|
10
|
+
a.modules.should == {
|
11
|
+
:console=>@console,
|
12
|
+
:google=>@google,
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'with modules' do
|
18
|
+
before(:each) do
|
19
|
+
Analytical::Console::Api.stub!(:new).and_return(@console = mock('console'))
|
20
|
+
Analytical::Google::Api.stub!(:new).and_return(@google = mock('google'))
|
21
|
+
Analytical::Clicky::Api.stub!(:new).and_return(@clicky = mock('clicky'))
|
22
|
+
|
23
|
+
@api = Analytical::Api.new :modules=>[:console, :google]
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#track' do
|
27
|
+
it 'should store the #track command for each module api class' do
|
28
|
+
@api = Analytical::Api.new :modules=>[:console, :google, :clicky]
|
29
|
+
|
30
|
+
@console.should_receive(:queue).with(:track, 'something', {:a=>1, :b=>2})
|
31
|
+
@clicky.should_receive(:queue).with(:track, 'something', {:a=>1, :b=>2})
|
32
|
+
@google.should_receive(:queue).with(:track, 'something', {:a=>1, :b=>2})
|
33
|
+
|
34
|
+
@api.track('something', {:a=>1, :b=>2})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#identify' do
|
39
|
+
it 'should store the #track command for each module api class' do
|
40
|
+
@api = Analytical::Api.new :modules=>[:console, :google, :clicky]
|
41
|
+
|
42
|
+
@console.should_receive(:queue).with(:identify, 'something', {:a=>1, :b=>2})
|
43
|
+
@clicky.should_receive(:queue).with(:identify, 'something', {:a=>1, :b=>2})
|
44
|
+
@google.should_receive(:queue).with(:identify, 'something', {:a=>1, :b=>2})
|
45
|
+
|
46
|
+
@api.identify('something', {:a=>1, :b=>2})
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#now' do
|
51
|
+
it 'should call a command on each module and collect the results' do
|
52
|
+
@api = Analytical::Api.new :modules=>[:console, :google, :clicky]
|
53
|
+
|
54
|
+
@console.should_receive(:track).with('something', {:a=>1, :b=>2}).and_return('console track')
|
55
|
+
@clicky.should_receive(:track).with('something', {:a=>1, :b=>2}).and_return('clicky track')
|
56
|
+
@google.should_receive(:track).with('something', {:a=>1, :b=>2}).and_return('google track')
|
57
|
+
|
58
|
+
@api.now.track('something', {:a=>1, :b=>2}).should == "console track\ngoogle track\nclicky track"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'when accessing a module by name' do
|
63
|
+
it 'should return the module api object' do
|
64
|
+
@api = Analytical::Api.new :modules=>[:console, :google, :clicky]
|
65
|
+
@api.console.should == @console
|
66
|
+
@api.clicky.should == @clicky
|
67
|
+
@api.google.should == @google
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'gathering javascript' do
|
72
|
+
before(:each) do
|
73
|
+
@console.stub!(:tracking_command_location).and_return(:body_prepend)
|
74
|
+
@console.stub!(:process_queued_commands).and_return([])
|
75
|
+
@google.stub!(:tracking_command_location).and_return(:body_prepend)
|
76
|
+
@google.stub!(:process_queued_commands).and_return([])
|
77
|
+
end
|
78
|
+
describe '#head_javascript' do
|
79
|
+
it 'should return the javascript' do
|
80
|
+
@console.should_receive(:init_javascript).with(:head).and_return('console_a')
|
81
|
+
@google.should_receive(:init_javascript).with(:head).and_return('google_a')
|
82
|
+
@api.head_javascript.should == "console_a\ngoogle_a"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
describe '#body_prepend_javascript' do
|
86
|
+
it 'should return the javascript' do
|
87
|
+
@console.should_receive(:init_javascript).with(:body_prepend).and_return('console_b')
|
88
|
+
@google.should_receive(:init_javascript).with(:body_prepend).and_return('google_b')
|
89
|
+
@api.body_prepend_javascript.should == "console_b\ngoogle_b"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
describe '#body_append_javascript' do
|
93
|
+
it 'should return the javascript' do
|
94
|
+
@console.should_receive(:init_javascript).with(:body_append).and_return('console_c')
|
95
|
+
@google.should_receive(:init_javascript).with(:body_append).and_return('google_c')
|
96
|
+
@api.body_append_javascript.should == "console_c\ngoogle_c"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
describe 'with stored commands' do
|
100
|
+
before(:each) do
|
101
|
+
@console.stub!(:track).and_return('console track called')
|
102
|
+
@console.stub!(:queue)
|
103
|
+
@console.stub!(:process_queued_commands).and_return(['console track called'])
|
104
|
+
@google.stub!(:track).and_return('google track called')
|
105
|
+
@google.stub!(:queue)
|
106
|
+
@google.stub!(:process_queued_commands).and_return(['google track called'])
|
107
|
+
@api.track('something', {:a=>1, :b=>2})
|
108
|
+
end
|
109
|
+
describe '#body_prepend_javascript' do
|
110
|
+
it 'should return the javascript' do
|
111
|
+
@console.should_receive(:init_javascript).with(:body_prepend).and_return('console_b')
|
112
|
+
@google.should_receive(:init_javascript).with(:body_prepend).and_return('google_b')
|
113
|
+
@api.body_prepend_javascript.should == "console_b\ngoogle_b\n<script type='text/javascript'>\nconsole track called\ngoogle track called\n</script>"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Analytical::Clicky::Api" do
|
4
|
+
before(:each) do
|
5
|
+
@parent = mock('api', :options=>{:google=>{:key=>'abc'}})
|
6
|
+
end
|
7
|
+
describe 'on initialize' do
|
8
|
+
it 'should set the command_location' do
|
9
|
+
a = Analytical::Clicky::Api.new @parent, {:key=>'abc'}
|
10
|
+
a.tracking_command_location.should == :body_append
|
11
|
+
end
|
12
|
+
it 'should set the options' do
|
13
|
+
a = Analytical::Clicky::Api.new @parent, {:key=>'abc'}
|
14
|
+
a.options.should == {:key=>'abc'}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe '#track' do
|
18
|
+
it 'should return the tracking javascript' do
|
19
|
+
@api = Analytical::Clicky::Api.new @parent, {:key=>'abcdef'}
|
20
|
+
@api.track('pagename', {:some=>'data'}).should == "clicky.log(\"pagename\");"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe '#identify' do
|
24
|
+
it 'should return the init code string' do
|
25
|
+
@api = Analytical::Clicky::Api.new @parent, {:key=>'abcdef'}
|
26
|
+
@api.identify('user id', {:a=>'b'}).should =~ /#{Regexp.escape({:id=>'user id', :a=>'b'}.to_json)}/
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe '#init_javascript' do
|
30
|
+
it 'should return the init javascript' do
|
31
|
+
@api = Analytical::Clicky::Api.new @parent, {:key=>'abcdef'}
|
32
|
+
@api.init_javascript[:head].should be_nil
|
33
|
+
@api.init_javascript[:body_prepend].should be_nil
|
34
|
+
@api.init_javascript[:body_append].should =~ /static.getclicky.com\/js/
|
35
|
+
@api.init_javascript[:body_append].should =~ /abcdef/
|
36
|
+
end
|
37
|
+
describe 'for an ssl connection' do
|
38
|
+
it 'should return the ssl init code' do
|
39
|
+
@api = Analytical::Clicky::Api.new @parent, {:key=>'abcdef', :ssl=>true}
|
40
|
+
@api.init_javascript[:body_append].should =~ /https/
|
41
|
+
end
|
42
|
+
end
|
43
|
+
describe 'with an identify command queued' do
|
44
|
+
@api = Analytical::Clicky::Api.new @parent, {:key=>'abcdef'}
|
45
|
+
@api.queue :identify, 'user id', {:email=>'someone@test.com'}
|
46
|
+
@api.init_javascript[:body_append].should =~ /"email":\w*"someone@test\.com"/
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Analytical::Google::Api" do
|
4
|
+
before(:each) do
|
5
|
+
@parent = mock('api', :options=>{:google=>{:key=>'abc'}})
|
6
|
+
end
|
7
|
+
describe 'on initialize' do
|
8
|
+
it 'should set the command_location' do
|
9
|
+
a = Analytical::Google::Api.new @parent, {:key=>'abc'}
|
10
|
+
a.tracking_command_location.should == :body_prepend
|
11
|
+
end
|
12
|
+
it 'should set the options' do
|
13
|
+
a = Analytical::Google::Api.new @parent, {:key=>'abc'}
|
14
|
+
a.options.should == {:key=>'abc'}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe '#track' do
|
18
|
+
it 'should return the tracking javascript' do
|
19
|
+
@api = Analytical::Google::Api.new @parent, {:key=>'abcdef'}
|
20
|
+
@api.track('pagename', {:some=>'data'}).should == "googleAnalyticsTracker._trackPageview(\"pagename\");"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe '#identify' do
|
24
|
+
it 'should return an empty string' do
|
25
|
+
@api = Analytical::Google::Api.new @parent, {:key=>'abcdef'}
|
26
|
+
@api.identify('nothing', {:matters=>'at all'}).should == ''
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe '#init_javascript' do
|
30
|
+
it 'should return the init javascript' do
|
31
|
+
@api = Analytical::Google::Api.new @parent, {:key=>'abcdef'}
|
32
|
+
@api.init_javascript[:head].should be_nil
|
33
|
+
@api.init_javascript[:body_prepend].should =~ /google-analytics.com\/ga.js/
|
34
|
+
@api.init_javascript[:body_prepend].should =~ /abcdef/
|
35
|
+
@api.init_javascript[:body_append].should be_nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Analytical::KissMetrics::Api" do
|
4
|
+
before(:each) do
|
5
|
+
@parent = mock('api', :options=>{:google=>{:key=>'abc'}})
|
6
|
+
end
|
7
|
+
describe 'on initialize' do
|
8
|
+
it 'should set the command_location' do
|
9
|
+
a = Analytical::KissMetrics::Api.new @parent, {:key=>'abc'}
|
10
|
+
a.tracking_command_location.should == :body_prepend
|
11
|
+
end
|
12
|
+
it 'should set the options' do
|
13
|
+
a = Analytical::KissMetrics::Api.new @parent, {:key=>'abc'}
|
14
|
+
a.options.should == {:key=>'abc'}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe '#track' do
|
18
|
+
it 'should return the tracking javascript' do
|
19
|
+
@api = Analytical::KissMetrics::Api.new @parent, {:key=>'abcdef'}
|
20
|
+
@api.track('pagename', {:some=>'data'}).should == ''
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe '#identify' do
|
24
|
+
it 'should return an empty string' do
|
25
|
+
@api = Analytical::KissMetrics::Api.new @parent, {:key=>'abcdef'}
|
26
|
+
@api.identify('id', {:email=>'test@test.com'}).should == "_kmq.push([\"identify\", \"test@test.com\"]);"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe '#event' do
|
30
|
+
it 'should return an empty string' do
|
31
|
+
@api = Analytical::KissMetrics::Api.new @parent, {:key=>'abcdef'}
|
32
|
+
@api.event('Big Deal', {:something=>'good'}).should == "_kmq.push([\"record\", \"Big Deal\", #{{:something=>'good'}.to_json}]);"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe '#init_javascript' do
|
36
|
+
it 'should return the init javascript' do
|
37
|
+
@api = Analytical::KissMetrics::Api.new @parent, {:key=>'abcdef'}
|
38
|
+
@api.init_javascript[:head].should be_nil
|
39
|
+
@api.init_javascript[:body_prepend].should =~ /scripts.kissmetrics.com/
|
40
|
+
@api.init_javascript[:body_prepend].should =~ /abcdef/
|
41
|
+
@api.init_javascript[:body_append].should be_nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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 request; OpenStruct.new(:'ssl?'=>true); end
|
15
|
+
def self.helper_method(*a); end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have the default options' do
|
19
|
+
DummyForInit.analytical
|
20
|
+
d = DummyForInit.new.analytical
|
21
|
+
d.options[:modules].should == []
|
22
|
+
d.options[:development_modules].should == [:console]
|
23
|
+
d.options[:disable_if].call.should be_false
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should open the initialization file' do
|
27
|
+
File.should_receive(:'exists?').with("#{RAILS_ROOT}/config/analytical.yml").and_return(true)
|
28
|
+
DummyForInit.analytical
|
29
|
+
DummyForInit.analytical_options[:google].should == {:key=>'google_12345'}
|
30
|
+
DummyForInit.analytical_options[:kiss_metrics].should == {:key=>'kiss_metrics_12345'}
|
31
|
+
DummyForInit.analytical_options[:clicky].should == {:key=>'clicky_12345'}
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'in production mode' do
|
35
|
+
before(:each) do
|
36
|
+
Rails.env.stub!(:production?).and_return(true)
|
37
|
+
end
|
38
|
+
it 'should start with no modules' do
|
39
|
+
Analytical::Api.should_not_receive(:include)
|
40
|
+
DummyForInit.analytical
|
41
|
+
DummyForInit.new.analytical.options[:modules] = []
|
42
|
+
end
|
43
|
+
it 'should include specific modules' do
|
44
|
+
Analytical::Api.should_receive(:include).with(Analytical::Console)
|
45
|
+
Analytical::Api.should_receive(:include).with(Analytical::Google)
|
46
|
+
DummyForInit.analytical :modules=>[:google, :console]
|
47
|
+
DummyForInit.new.analytical.options[:modules] = [:google, :console]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'in development mode' do
|
52
|
+
before(:each) do
|
53
|
+
Rails.env.stub!(:production?).and_return(false)
|
54
|
+
end
|
55
|
+
it 'should start with no modules' do
|
56
|
+
Analytical::Api.should_receive(:include).with(Analytical::Console)
|
57
|
+
DummyForInit.analytical
|
58
|
+
DummyForInit.new.analytical.options[:modules] = [:console]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
+
require 'analytical/api'
|
12
|
+
require 'analytical/base'
|
13
|
+
require 'analytical/console'
|
14
|
+
require 'analytical/google'
|
15
|
+
require 'analytical/clicky'
|
16
|
+
|
17
|
+
Spec::Runner.configure do |config|
|
18
|
+
end
|
19
|
+
|
20
|
+
module Rails
|
21
|
+
end
|
22
|
+
RAILS_ROOT = File.dirname(__FILE__)
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: analytical
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Joshua Krall
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-28 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
version: 1.2.9
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: activesupport
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
46
|
+
description: Gem for managing multiple analytics services in your rails app.
|
47
|
+
email: josh@transfs.com
|
48
|
+
executables: []
|
49
|
+
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- LICENSE
|
54
|
+
- README.rdoc
|
55
|
+
files:
|
56
|
+
- .document
|
57
|
+
- .gitignore
|
58
|
+
- LICENSE
|
59
|
+
- README.rdoc
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- analytical.gemspec
|
63
|
+
- example/.gitignore
|
64
|
+
- example/Gemfile
|
65
|
+
- example/README
|
66
|
+
- example/Rakefile
|
67
|
+
- example/app/controllers/application_controller.rb
|
68
|
+
- example/app/controllers/page_controller.rb
|
69
|
+
- example/app/helpers/application_helper.rb
|
70
|
+
- example/app/helpers/page_helper.rb
|
71
|
+
- example/app/views/layouts/application.html.erb
|
72
|
+
- example/app/views/page/index.html.erb
|
73
|
+
- example/app/views/page/test_a.html.erb
|
74
|
+
- example/app/views/page/test_b.html.erb
|
75
|
+
- example/config.ru
|
76
|
+
- example/config/analytical.yml
|
77
|
+
- example/config/application.rb
|
78
|
+
- example/config/boot.rb
|
79
|
+
- example/config/database.yml
|
80
|
+
- example/config/environment.rb
|
81
|
+
- example/config/environments/development.rb
|
82
|
+
- example/config/environments/production.rb
|
83
|
+
- example/config/environments/test.rb
|
84
|
+
- example/config/initializers/backtrace_silencers.rb
|
85
|
+
- example/config/initializers/inflections.rb
|
86
|
+
- example/config/initializers/mime_types.rb
|
87
|
+
- example/config/initializers/secret_token.rb
|
88
|
+
- example/config/initializers/session_store.rb
|
89
|
+
- example/config/locales/en.yml
|
90
|
+
- example/config/routes.rb
|
91
|
+
- example/db/seeds.rb
|
92
|
+
- example/doc/README_FOR_APP
|
93
|
+
- example/lib/tasks/.gitkeep
|
94
|
+
- example/public/404.html
|
95
|
+
- example/public/422.html
|
96
|
+
- example/public/500.html
|
97
|
+
- example/public/favicon.ico
|
98
|
+
- example/public/images/rails.png
|
99
|
+
- example/public/javascripts/application.js
|
100
|
+
- example/public/javascripts/controls.js
|
101
|
+
- example/public/javascripts/dragdrop.js
|
102
|
+
- example/public/javascripts/effects.js
|
103
|
+
- example/public/javascripts/prototype.js
|
104
|
+
- example/public/javascripts/rails.js
|
105
|
+
- example/public/robots.txt
|
106
|
+
- example/public/stylesheets/.gitkeep
|
107
|
+
- example/script/rails
|
108
|
+
- example/test/functional/page_controller_test.rb
|
109
|
+
- example/test/performance/browsing_test.rb
|
110
|
+
- example/test/test_helper.rb
|
111
|
+
- example/test/unit/helpers/page_helper_test.rb
|
112
|
+
- example/vendor/plugins/.gitkeep
|
113
|
+
- lib/analytical.rb
|
114
|
+
- lib/analytical/api.rb
|
115
|
+
- lib/analytical/base.rb
|
116
|
+
- lib/analytical/clicky.rb
|
117
|
+
- lib/analytical/console.rb
|
118
|
+
- lib/analytical/google.rb
|
119
|
+
- lib/analytical/kiss_metrics.rb
|
120
|
+
- rails/init.rb
|
121
|
+
- spec/analytical/api_spec.rb
|
122
|
+
- spec/analytical/clicky_spec.rb
|
123
|
+
- spec/analytical/google_spec.rb
|
124
|
+
- spec/analytical/kiss_metrics_spec.rb
|
125
|
+
- spec/analytical_spec.rb
|
126
|
+
- spec/config/analytical.yml
|
127
|
+
- spec/spec.opts
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
has_rdoc: true
|
130
|
+
homepage: http://github.com/jkrall/analytical
|
131
|
+
licenses: []
|
132
|
+
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options:
|
135
|
+
- --charset=UTF-8
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
version: "0"
|
152
|
+
requirements: []
|
153
|
+
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 1.3.6
|
156
|
+
signing_key:
|
157
|
+
specification_version: 3
|
158
|
+
summary: Gem for managing multiple analytics services in your rails app.
|
159
|
+
test_files:
|
160
|
+
- spec/analytical/api_spec.rb
|
161
|
+
- spec/analytical/clicky_spec.rb
|
162
|
+
- spec/analytical/google_spec.rb
|
163
|
+
- spec/analytical/kiss_metrics_spec.rb
|
164
|
+
- spec/analytical_spec.rb
|
165
|
+
- spec/spec_helper.rb
|