angerfist 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 570cfab56b1e1c2f3ff239ed554641cd5ddd314c
4
+ data.tar.gz: 5ebf3825f97c153f7a401ba22c5f83736fac78f3
5
+ SHA512:
6
+ metadata.gz: cc57f603d5c6e1720a68410f9f69e5ff46dc3024b644008a324fef9f528d78bf9fea60cfb88333e15556cb2c236a368692fb4872a26b3ff2d566bc48117bfab0
7
+ data.tar.gz: a5522fda54d14a47c01d4c70cd15d79b22f87aeb0a3cfb9c2d46f13b59af9e15b926a25839b60e08900a0aff0dfb9a1c896ea9e81b22314ce354948f76e7c171
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in angerfist.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ ##Copyright (c) 2013 Sam Pikesley
2
+
3
+ #MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ [![Dependency Status](http://img.shields.io/gemnasium/OpenAddressesUK/angerfist.svg)](https://gemnasium.com/OpenAddressesUK/angerfist)
2
+ [![Code Climate](http://img.shields.io/codeclimate/github/OpenAddressesUK/angerfist.svg)](https://codeclimate.com/github/OpenAddressesUK/angerfist)
3
+ [![Gem Version](http://img.shields.io/gem/v/angerfist.svg)](https://rubygems.org/gems/angerfist)
4
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://OpenAddressesUK.mit-license.org)
5
+ [![Badges](http://img.shields.io/:badges-5/5-ff6799.svg)](https://github.com/badges/badgerbadgerbadger)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/angerfist.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'angerfist/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'angerfist'
8
+ spec.version = Angerfist::VERSION
9
+ spec.authors = ['pikesley']
10
+ spec.email = ['tech@openaddressesuk.org']
11
+ spec.summary = %q{Rack middleware for Google Analytics tracking server-side}
12
+ spec.description = %q{Rack middleware for Google Analytics tracking server-side}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'rack', '~> 1.6'
22
+ spec.add_dependency 'gabba', '~> 1.0'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.7'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.2'
27
+ spec.add_development_dependency 'pry', '~> 0.10'
28
+ end
@@ -0,0 +1,20 @@
1
+ module Rack
2
+ class Angerfist
3
+ def initialize app, config
4
+ @app = app
5
+ @gabba = Gabba::Gabba.new(config[:tracker_id], config[:domain])
6
+ end
7
+
8
+ def call env
9
+ @env = env
10
+ status, headers, response = @app.call(@env)
11
+ @gabba.page_view(full_path, full_path)
12
+
13
+ [ status, headers, response ]
14
+ end
15
+
16
+ def full_path
17
+ (@env['PATH_INFO'] + '?' + @env['QUERY_STRING']).chomp('?')
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module Angerfist
2
+ VERSION = "0.0.1"
3
+ end
data/lib/angerfist.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rack'
2
+ require 'gabba'
3
+
4
+ require "angerfist/version"
5
+ require "angerfist/angerfist"
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ module Rack
4
+ describe Angerfist do
5
+ let :config do
6
+ {
7
+ tracker_id: "UA-xxxxxxx-x",
8
+ domain: "http://test.domain"
9
+ }
10
+ end
11
+
12
+ it 'tracks a page view' do
13
+ app = proc{
14
+ [
15
+ 200,
16
+ {},
17
+ [
18
+ 'Hello, world'
19
+ ]
20
+ ]
21
+ }
22
+
23
+ middleware = Angerfist.new(app, config)
24
+ request = Rack::MockRequest.new(middleware)
25
+
26
+ expect_any_instance_of(Gabba::Gabba).to receive(:page_view)
27
+ request.get('addresses/address.json', {})
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,13 @@
1
+ require 'angerfist'
2
+
3
+ RSpec.configure do |config|
4
+ config.expect_with :rspec do |expectations|
5
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
6
+ end
7
+
8
+ config.mock_with :rspec do |mocks|
9
+ mocks.verify_partial_doubles = true
10
+ end
11
+
12
+ config.order = :random
13
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: angerfist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - pikesley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gabba
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.10'
97
+ description: Rack middleware for Google Analytics tracking server-side
98
+ email:
99
+ - tech@openaddressesuk.org
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - Gemfile
107
+ - LICENSE.md
108
+ - README.md
109
+ - Rakefile
110
+ - angerfist.gemspec
111
+ - lib/angerfist.rb
112
+ - lib/angerfist/angerfist.rb
113
+ - lib/angerfist/version.rb
114
+ - spec/angerfist/angerfist_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: ''
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.5
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Rack middleware for Google Analytics tracking server-side
140
+ test_files:
141
+ - spec/angerfist/angerfist_spec.rb
142
+ - spec/spec_helper.rb