garails 0.1.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +1 -8
- data/LICENSE.txt +21 -0
- data/README.rdoc +0 -2
- data/app/views/garails/_google_analytics.html.erb +13 -18
- data/app/views/garails/_no_google_analytics.html.erb +1 -1
- data/config.ru +7 -0
- data/config/routes.rb +1 -1
- data/garails.gemspec +10 -5
- data/lib/garails.rb +1 -29
- data/lib/garails/engine.rb +0 -6
- data/lib/garails/version.rb +1 -1
- data/spec/helpers/javascript_helper_spec.rb +26 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/db/schema.rb +3 -0
- data/spec/internal/log/.gitignore +1 -0
- data/{test/test_app → spec/internal}/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +14 -0
- metadata +83 -78
- data/Gemfile.lock +0 -93
- data/app/controllers/garails/google_analytics_controller.rb +0 -50
- data/app/helpers/garails/event_helper.rb +0 -7
- data/app/helpers/garails/mobile_helper.rb +0 -18
- data/config/initializers/mime_types.rb +0 -1
- data/test/controllers/google_analytics_controller_test.rb +0 -36
- data/test/test_app/.gitignore +0 -3
- data/test/test_app/app/controllers/application_controller.rb +0 -3
- data/test/test_app/app/helpers/application_helper.rb +0 -2
- data/test/test_app/app/views/layouts/application.html.erb +0 -14
- data/test/test_app/config.ru +0 -4
- data/test/test_app/config/application.rb +0 -13
- data/test/test_app/config/boot.rb +0 -3
- data/test/test_app/config/database.yml +0 -22
- data/test/test_app/config/environment.rb +0 -5
- data/test/test_app/config/environments/test.rb +0 -30
- data/test/test_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/test_app/config/initializers/garails.rb +0 -1
- data/test/test_app/config/initializers/inflections.rb +0 -10
- data/test/test_app/config/initializers/mime_types.rb +0 -5
- data/test/test_app/config/initializers/secret_token.rb +0 -7
- data/test/test_app/config/initializers/session_store.rb +0 -8
- data/test/test_app/config/routes.rb +0 -2
- data/test/test_app/db/seeds.rb +0 -7
- data/test/test_app/public/404.html +0 -26
- data/test/test_app/public/422.html +0 -26
- data/test/test_app/public/500.html +0 -26
- data/test/test_app/script/rails +0 -6
- data/test/test_helper.rb +0 -8
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd82a95ad5f4d8cca67149097da4252ec2dfc0eccdfbac963a0b5c736f12b058
|
4
|
+
data.tar.gz: d223602e947e3928bcf20a4dc614d3e9cf480126480c4f000c9f4ef40bf04123
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0fb2c9624eb6a3306277f96910cec92c30e31464ee454e8a800e74b710b17a2da25900ef2b156b2a12d36082d351d0f0f14b4aacf61a4730d3c701c2945719ab
|
7
|
+
data.tar.gz: e19c0751511ca35049800b64a290e40d6f7aa45acb5be0b1f6ea02ad142b99216a402b86d3acdf629493eaa6a9f77d6f2129c74d2839d52b8cd4164d09e3eef2
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Paul McMahon
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
<script
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<script>
|
2
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
3
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
4
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
5
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
6
|
+
|
7
|
+
ga('create', '<%= Garails.ga_account %>', 'auto');
|
8
|
+
ga('send', 'pageview');
|
9
|
+
|
10
|
+
<% if extra_account %>
|
11
|
+
ga('create', '<%= extra_account %>', 'auto', 'extraTracker');
|
12
|
+
ga('extraTracker.send', 'pageview');
|
13
|
+
<% end %>
|
13
14
|
|
14
|
-
(function() {
|
15
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
16
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
17
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
18
|
-
})();
|
19
|
-
//]]>
|
20
15
|
</script>
|
data/config.ru
ADDED
data/config/routes.rb
CHANGED
data/garails.gemspec
CHANGED
@@ -5,10 +5,11 @@ require "garails/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "garails"
|
7
7
|
s.version = Garails::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.
|
10
|
-
s.
|
11
|
-
s.
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.licenses = ["MIT"]
|
10
|
+
s.authors = 'Michael Reinsch', 'Paul McMahon'
|
11
|
+
s.email = "admins@doorkeeper.jp"
|
12
|
+
s.homepage = "http://github.com/doorkeeper/garails"
|
12
13
|
s.description = "Google Analytics for Rails"
|
13
14
|
s.summary = "Google Analytics for Rails"
|
14
15
|
|
@@ -17,5 +18,9 @@ Gem::Specification.new do |s|
|
|
17
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
19
|
s.require_paths = ["lib"]
|
19
20
|
|
20
|
-
s.add_dependency
|
21
|
+
s.add_dependency "rails", ">= 4.0.0"
|
22
|
+
|
23
|
+
s.add_development_dependency "combustion"
|
24
|
+
s.add_development_dependency "rspec-rails"
|
25
|
+
s.add_development_dependency "capybara"
|
21
26
|
end
|
data/lib/garails.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rails'
|
2
2
|
|
3
3
|
module Garails
|
4
4
|
|
@@ -6,37 +6,9 @@ module Garails
|
|
6
6
|
mattr_accessor :ga_account
|
7
7
|
@@ga_account = nil
|
8
8
|
|
9
|
-
# cookie domain for the tracking cookie. Only set this if you need to
|
10
|
-
# (e.g. for subdomain tracking). Corresponds to "_setDomainName".
|
11
|
-
mattr_accessor :ga_cookie_domain
|
12
|
-
@@ga_cookie_domain = nil
|
13
|
-
|
14
|
-
# the host name (such as www.example.com). This is usually derived from the
|
15
|
-
# incoming request. Set it here if you want to enable tracking outside your
|
16
|
-
# controllers or views.
|
17
|
-
mattr_accessor :ga_hostname
|
18
|
-
@@ga_hostname = nil
|
19
|
-
|
20
9
|
def self.ga_setup?
|
21
10
|
! Garails.ga_account.blank?
|
22
11
|
end
|
23
|
-
|
24
|
-
def self.ga_mobile_account
|
25
|
-
ga_account.sub(/^UA-/, 'MO-')
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.gabba(request, opts = {})
|
29
|
-
create_gabba(Garails.ga_account, request, opts)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.mobile_gabba(request, opts = {})
|
33
|
-
create_gabba(Garails.ga_mobile_account, request, opts)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.create_gabba(account, request, opts = {})
|
37
|
-
opts = opts.reverse_merge(:request => request, :logger => Rails.logger)
|
38
|
-
::Gabbara::Gabba.new(account, Garails.ga_hostname, opts)
|
39
|
-
end
|
40
12
|
end
|
41
13
|
|
42
14
|
require 'garails/version'
|
data/lib/garails/engine.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
|
2
2
|
module Garails
|
3
3
|
class Engine < ::Rails::Engine
|
4
|
-
initializer 'garails.view.helper' do |app|
|
5
|
-
ActionController::Base.helper Garails::MobileHelper, Garails::JavascriptHelper, Garails::EventHelper
|
6
|
-
end
|
7
|
-
initializer 'garails.controller.helper' do |app|
|
8
|
-
ActionController::Base.send :include, Garails::EventHelper
|
9
|
-
end
|
10
4
|
end
|
11
5
|
end
|
data/lib/garails/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Garails::JavascriptHelper, type: :helper do
|
4
|
+
after { Garails.ga_account = nil }
|
5
|
+
|
6
|
+
context "no analytics account setup" do
|
7
|
+
subject { google_analytics_tracking_javascript }
|
8
|
+
it { should include("no google analytics account setup") }
|
9
|
+
end
|
10
|
+
|
11
|
+
context "has analytics account setup" do
|
12
|
+
before { Garails.ga_account = "UA-FOO" }
|
13
|
+
subject { google_analytics_tracking_javascript }
|
14
|
+
it { should include("ga('create', 'UA-FOO', 'auto')") }
|
15
|
+
it { should include("ga('send', 'pageview')") }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "has extra account setup" do
|
19
|
+
before { Garails.ga_account = "UA-FOO" }
|
20
|
+
subject { google_analytics_tracking_javascript("UA-OTHER") }
|
21
|
+
it { should include("ga('create', 'UA-FOO', 'auto')") }
|
22
|
+
it { should include("ga('send', 'pageview')") }
|
23
|
+
it { should include("ga('create', 'UA-OTHER', 'auto', 'extraTracker')") }
|
24
|
+
it { should include("ga('extraTracker.send', 'pageview')") }
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'combustion'
|
5
|
+
require 'capybara/rspec'
|
6
|
+
|
7
|
+
Combustion.initialize! :action_controller, :action_view
|
8
|
+
|
9
|
+
require 'rspec/rails'
|
10
|
+
require 'capybara/rails'
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.use_transactional_fixtures = true
|
14
|
+
end
|
metadata
CHANGED
@@ -1,122 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Reinsch
|
9
|
-
|
8
|
+
- Paul McMahon
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0
|
20
|
+
version: 4.0.0
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 4.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: combustion
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec-rails
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: capybara
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
25
70
|
description: Google Analytics for Rails
|
26
|
-
email:
|
71
|
+
email: admins@doorkeeper.jp
|
27
72
|
executables: []
|
28
73
|
extensions: []
|
29
74
|
extra_rdoc_files: []
|
30
75
|
files:
|
31
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
32
77
|
- Gemfile
|
33
|
-
-
|
78
|
+
- LICENSE.txt
|
34
79
|
- README.rdoc
|
35
80
|
- Rakefile
|
36
|
-
- app/controllers/garails/google_analytics_controller.rb
|
37
|
-
- app/helpers/garails/event_helper.rb
|
38
81
|
- app/helpers/garails/javascript_helper.rb
|
39
|
-
- app/helpers/garails/mobile_helper.rb
|
40
82
|
- app/views/garails/_google_analytics.html.erb
|
41
83
|
- app/views/garails/_no_google_analytics.html.erb
|
42
|
-
- config
|
84
|
+
- config.ru
|
43
85
|
- config/routes.rb
|
44
86
|
- garails.gemspec
|
45
87
|
- lib/garails.rb
|
46
88
|
- lib/garails/engine.rb
|
47
89
|
- lib/garails/version.rb
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
|
56
|
-
|
57
|
-
-
|
58
|
-
|
59
|
-
|
60
|
-
- test/test_app/config/initializers/garails.rb
|
61
|
-
- test/test_app/config/initializers/inflections.rb
|
62
|
-
- test/test_app/config/initializers/mime_types.rb
|
63
|
-
- test/test_app/config/initializers/secret_token.rb
|
64
|
-
- test/test_app/config/initializers/session_store.rb
|
65
|
-
- test/test_app/config/routes.rb
|
66
|
-
- test/test_app/db/seeds.rb
|
67
|
-
- test/test_app/public/404.html
|
68
|
-
- test/test_app/public/422.html
|
69
|
-
- test/test_app/public/500.html
|
70
|
-
- test/test_app/public/favicon.ico
|
71
|
-
- test/test_app/script/rails
|
72
|
-
- test/test_helper.rb
|
73
|
-
homepage: http://github.com/mreinsch/garails
|
74
|
-
licenses: []
|
75
|
-
post_install_message:
|
90
|
+
- spec/helpers/javascript_helper_spec.rb
|
91
|
+
- spec/internal/config/database.yml
|
92
|
+
- spec/internal/config/routes.rb
|
93
|
+
- spec/internal/db/schema.rb
|
94
|
+
- spec/internal/log/.gitignore
|
95
|
+
- spec/internal/public/favicon.ico
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
homepage: http://github.com/doorkeeper/garails
|
98
|
+
licenses:
|
99
|
+
- MIT
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
76
102
|
rdoc_options: []
|
77
103
|
require_paths:
|
78
104
|
- lib
|
79
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
106
|
requirements:
|
82
|
-
- -
|
107
|
+
- - ">="
|
83
108
|
- !ruby/object:Gem::Version
|
84
109
|
version: '0'
|
85
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
111
|
requirements:
|
88
|
-
- -
|
112
|
+
- - ">="
|
89
113
|
- !ruby/object:Gem::Version
|
90
114
|
version: '0'
|
91
115
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
specification_version: 3
|
116
|
+
rubygems_version: 3.2.15
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
96
119
|
summary: Google Analytics for Rails
|
97
120
|
test_files:
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
- test/test_app/config/boot.rb
|
106
|
-
- test/test_app/config/database.yml
|
107
|
-
- test/test_app/config/environment.rb
|
108
|
-
- test/test_app/config/environments/test.rb
|
109
|
-
- test/test_app/config/initializers/backtrace_silencers.rb
|
110
|
-
- test/test_app/config/initializers/garails.rb
|
111
|
-
- test/test_app/config/initializers/inflections.rb
|
112
|
-
- test/test_app/config/initializers/mime_types.rb
|
113
|
-
- test/test_app/config/initializers/secret_token.rb
|
114
|
-
- test/test_app/config/initializers/session_store.rb
|
115
|
-
- test/test_app/config/routes.rb
|
116
|
-
- test/test_app/db/seeds.rb
|
117
|
-
- test/test_app/public/404.html
|
118
|
-
- test/test_app/public/422.html
|
119
|
-
- test/test_app/public/500.html
|
120
|
-
- test/test_app/public/favicon.ico
|
121
|
-
- test/test_app/script/rails
|
122
|
-
- test/test_helper.rb
|
121
|
+
- spec/helpers/javascript_helper_spec.rb
|
122
|
+
- spec/internal/config/database.yml
|
123
|
+
- spec/internal/config/routes.rb
|
124
|
+
- spec/internal/db/schema.rb
|
125
|
+
- spec/internal/log/.gitignore
|
126
|
+
- spec/internal/public/favicon.ico
|
127
|
+
- spec/spec_helper.rb
|
data/Gemfile.lock
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
garails (0.1.4)
|
5
|
-
gabbara (~> 0.0.5)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
abstract (1.0.0)
|
11
|
-
actionmailer (3.0.10)
|
12
|
-
actionpack (= 3.0.10)
|
13
|
-
mail (~> 2.2.19)
|
14
|
-
actionpack (3.0.10)
|
15
|
-
activemodel (= 3.0.10)
|
16
|
-
activesupport (= 3.0.10)
|
17
|
-
builder (~> 2.1.2)
|
18
|
-
erubis (~> 2.6.6)
|
19
|
-
i18n (~> 0.5.0)
|
20
|
-
rack (~> 1.2.1)
|
21
|
-
rack-mount (~> 0.6.14)
|
22
|
-
rack-test (~> 0.5.7)
|
23
|
-
tzinfo (~> 0.3.23)
|
24
|
-
activemodel (3.0.10)
|
25
|
-
activesupport (= 3.0.10)
|
26
|
-
builder (~> 2.1.2)
|
27
|
-
i18n (~> 0.5.0)
|
28
|
-
activerecord (3.0.10)
|
29
|
-
activemodel (= 3.0.10)
|
30
|
-
activesupport (= 3.0.10)
|
31
|
-
arel (~> 2.0.10)
|
32
|
-
tzinfo (~> 0.3.23)
|
33
|
-
activeresource (3.0.10)
|
34
|
-
activemodel (= 3.0.10)
|
35
|
-
activesupport (= 3.0.10)
|
36
|
-
activesupport (3.0.10)
|
37
|
-
addressable (2.2.6)
|
38
|
-
arel (2.0.10)
|
39
|
-
builder (2.1.2)
|
40
|
-
crack (0.3.1)
|
41
|
-
erubis (2.6.6)
|
42
|
-
abstract (>= 1.0.0)
|
43
|
-
flexmock (0.9.0)
|
44
|
-
gabbara (0.0.6)
|
45
|
-
activesupport
|
46
|
-
i18n (0.5.0)
|
47
|
-
mail (2.2.19)
|
48
|
-
activesupport (>= 2.3.6)
|
49
|
-
i18n (>= 0.4.0)
|
50
|
-
mime-types (~> 1.16)
|
51
|
-
treetop (~> 1.4.8)
|
52
|
-
mime-types (1.16)
|
53
|
-
polyglot (0.3.2)
|
54
|
-
rack (1.2.4)
|
55
|
-
rack-mount (0.6.14)
|
56
|
-
rack (>= 1.0.0)
|
57
|
-
rack-test (0.5.7)
|
58
|
-
rack (>= 1.0)
|
59
|
-
rails (3.0.10)
|
60
|
-
actionmailer (= 3.0.10)
|
61
|
-
actionpack (= 3.0.10)
|
62
|
-
activerecord (= 3.0.10)
|
63
|
-
activeresource (= 3.0.10)
|
64
|
-
activesupport (= 3.0.10)
|
65
|
-
bundler (~> 1.0)
|
66
|
-
railties (= 3.0.10)
|
67
|
-
railties (3.0.10)
|
68
|
-
actionpack (= 3.0.10)
|
69
|
-
activesupport (= 3.0.10)
|
70
|
-
rake (>= 0.8.7)
|
71
|
-
rdoc (~> 3.4)
|
72
|
-
thor (~> 0.14.4)
|
73
|
-
rake (0.9.2)
|
74
|
-
rdoc (3.9.4)
|
75
|
-
shoulda (2.11.3)
|
76
|
-
thor (0.14.6)
|
77
|
-
treetop (1.4.10)
|
78
|
-
polyglot
|
79
|
-
polyglot (>= 0.3.1)
|
80
|
-
tzinfo (0.3.30)
|
81
|
-
webmock (1.7.6)
|
82
|
-
addressable (~> 2.2, > 2.2.5)
|
83
|
-
crack (>= 0.1.7)
|
84
|
-
|
85
|
-
PLATFORMS
|
86
|
-
ruby
|
87
|
-
|
88
|
-
DEPENDENCIES
|
89
|
-
flexmock
|
90
|
-
garails!
|
91
|
-
rails (~> 3.0.3)
|
92
|
-
shoulda
|
93
|
-
webmock
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'gabbara'
|
2
|
-
require 'digest'
|
3
|
-
|
4
|
-
class Garails::GoogleAnalyticsController < ActionController::Base
|
5
|
-
unloadable
|
6
|
-
before_filter :extract_visitor_id
|
7
|
-
|
8
|
-
UTM_HEADERS = {
|
9
|
-
"Content-Type" => "image/gif",
|
10
|
-
"Cache-Control" => "private, no-cache, no-cache=Set-Cookie, proxy-revalidate",
|
11
|
-
"Pragma" => "no-cache",
|
12
|
-
"Expires" => "Wed, 17 Sep 1975 21:32:10 GMT" }
|
13
|
-
UTM_GIF_DATA = [
|
14
|
-
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0xff,
|
15
|
-
0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00,
|
16
|
-
0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b ].map{|i| i.chr }.join
|
17
|
-
UTM_COOKIE_NAME = "__utmmobile"
|
18
|
-
|
19
|
-
def utm
|
20
|
-
record_access if Garails.ga_setup?
|
21
|
-
response.headers.merge(UTM_HEADERS)
|
22
|
-
respond_to do |format|
|
23
|
-
format.gif { send_data UTM_GIF_DATA, :type => :gif, :disposition => "inline" }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def record_access
|
30
|
-
mobile_gabba.page_view('', :utmvid => @visitor_id)
|
31
|
-
end
|
32
|
-
|
33
|
-
def mobile_gabba
|
34
|
-
Garails.mobile_gabba(request, :utmn => params[:utmn], :utmcc => "__utma=999.999.999.999.999.1;", :utmhid => "")
|
35
|
-
end
|
36
|
-
|
37
|
-
def extract_visitor_id
|
38
|
-
@visitor_id = cookies[UTM_COOKIE_NAME] || construct_new_visitor_id
|
39
|
-
cookie_data = {:value => @visitor_id, :expires => Time.now + 2.years, :path => '/'}
|
40
|
-
cookie_data[:domain] = Garails.ga_cookie_domain unless Garails.ga_cookie_domain.blank?
|
41
|
-
cookies[UTM_COOKIE_NAME] = cookie_data
|
42
|
-
end
|
43
|
-
|
44
|
-
def construct_new_visitor_id
|
45
|
-
raw_visitor_id = request.env["HTTP_X_DCMGUID"].blank? ?
|
46
|
-
((request.env["HTTP_USER_AGENT"] || "") + rand(0x7fffffff).to_s) :
|
47
|
-
(request.env["HTTP_X_DCMGUID"] + (Garails.ga_account || 'unknown'))
|
48
|
-
"0x" + Digest::MD5.hexdigest(raw_visitor_id)[0, 16]
|
49
|
-
end
|
50
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Garails::MobileHelper
|
2
|
-
|
3
|
-
def utm_tag
|
4
|
-
tag "img", :src => utm_path, :alt => "", :width => "1", :height => "1"
|
5
|
-
end
|
6
|
-
|
7
|
-
def utm_path
|
8
|
-
referer = request.env['HTTP_REFERER']
|
9
|
-
url_for :controller => 'garails/google_analytics',
|
10
|
-
:action => 'utm',
|
11
|
-
:format => :gif,
|
12
|
-
:utmn => rand(0x7fffffff).to_s,
|
13
|
-
:utmr => referer.blank? ? "-" : referer,
|
14
|
-
:utmp => request.env['REQUEST_URI'],
|
15
|
-
:guid => "ON"
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Mime::Type.register "image/gif", :gif
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class GoogleAnalyticsControllerTest < ActionController::TestCase
|
4
|
-
tests Garails::GoogleAnalyticsController
|
5
|
-
|
6
|
-
context "GET to :utm" do
|
7
|
-
setup do
|
8
|
-
flexmock(@controller, :rand => 405451725)
|
9
|
-
stub_analytics("0xd5d59357458cc280")
|
10
|
-
get :utm, :format => :gif
|
11
|
-
end
|
12
|
-
should respond_with :success
|
13
|
-
should assign_to(:visitor_id)
|
14
|
-
end
|
15
|
-
|
16
|
-
context "GET to :utm with guid" do
|
17
|
-
setup do
|
18
|
-
stub_analytics("0x80620d96c658ed0f")
|
19
|
-
request.env["HTTP_X_DCMGUID"] = "blah"
|
20
|
-
get :utm, :format => :gif
|
21
|
-
end
|
22
|
-
should respond_with :success
|
23
|
-
should assign_to(:visitor_id)
|
24
|
-
end
|
25
|
-
|
26
|
-
def stub_analytics(vid)
|
27
|
-
query = {
|
28
|
-
:utmac => "MO-12345678-9", :utmcc => "__utma=999.999.999.999.999.1;", :utmcs => "UTF-8",
|
29
|
-
:utmhn => "example.org", :utmip => "0.0.0.0", :utmr => "-", :utmul => "en-us",
|
30
|
-
:utmvid => vid, :utmwv => "4.4sh" }
|
31
|
-
stub_request(:get, "http://www.google-analytics.com/__utm.gif").
|
32
|
-
with(:query => query, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Rails%20Testing'}).
|
33
|
-
to_return(:status => 200, :body => "", :headers => {})
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/test/test_app/.gitignore
DELETED
data/test/test_app/config.ru
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require "action_controller/railtie"
|
4
|
-
require "rails/test_unit/railtie"
|
5
|
-
|
6
|
-
Bundler.require :default, :test
|
7
|
-
|
8
|
-
module TestApp
|
9
|
-
class Application < Rails::Application
|
10
|
-
config.encoding = "utf-8"
|
11
|
-
config.filter_parameters += [:password]
|
12
|
-
end
|
13
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: db/development.sqlite3
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: db/test.sqlite3
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
17
|
-
|
18
|
-
production:
|
19
|
-
adapter: sqlite3
|
20
|
-
database: db/production.sqlite3
|
21
|
-
pool: 5
|
22
|
-
timeout: 5000
|
@@ -1,30 +0,0 @@
|
|
1
|
-
TestApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
18
|
-
config.action_dispatch.show_exceptions = false
|
19
|
-
|
20
|
-
# Disable request forgery protection in test environment
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
22
|
-
|
23
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
24
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
25
|
-
# like if you have constraints or database-specific column types
|
26
|
-
# config.active_record.schema_format = :sql
|
27
|
-
|
28
|
-
# Print deprecation notices to the stderr
|
29
|
-
config.active_support.deprecation = :stderr
|
30
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1 +0,0 @@
|
|
1
|
-
Garails.ga_account = 'UA-12345678-9'
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
TestApp::Application.config.secret_token = '50053f3c1b13b80ea9ef92a92fe29c47dbe487827d65f9bf20a55b05cbc3d7c5b934a6dddb93b6860867c48ad40f3259fa573e22b362e6605de501ef42f1aced'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
TestApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rails generate session_migration")
|
8
|
-
# TestApp::Application.config.session_store :active_record_store
|
data/test/test_app/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/test_app/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|