mixpal 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/mixpal.rb +19 -0
- data/lib/mixpal/tracker.rb +4 -2
- data/lib/mixpal/version.rb +1 -1
- data/spec/lib/mixpal/tracker_spec.rb +12 -0
- data/spec/lib/mixpal_spec.rb +11 -0
- data/spec/support/custom_events_module.rb +5 -0
- data/test_app/.gitignore +2 -0
- metadata +33 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c906d1348d8056d0a0ccf3921002f1c41e80a6
|
4
|
+
data.tar.gz: f6c3e3d5e7ab286f3a756c0b39f7bb5ccfd06d05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd3b71ccd0e9ec9d6f029428a53ae0ac2f90b2abd8600cfc73ac6c91c010cd192b32fec4acb282a8d60b954974203f625269dcddc8f6a760a2636ca3b8ccc6d
|
7
|
+
data.tar.gz: da85ac13dd876e5afddab38086e7b05f8dcc56bca1965a6ee2847a663ff7d4b48f69dcd84fc1b913b9aba3e29bce983c745bc98d0c9e8d8ce46b19a6cfe8231f
|
data/.rubocop.yml
CHANGED
data/lib/mixpal.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'mixpal/version'
|
2
|
+
require 'active_support'
|
2
3
|
require 'active_support/core_ext'
|
3
4
|
|
4
5
|
module Mixpal
|
@@ -7,4 +8,22 @@ module Mixpal
|
|
7
8
|
autoload :Event, 'mixpal/event'
|
8
9
|
autoload :User, 'mixpal/user'
|
9
10
|
autoload :Integration, 'mixpal/integration'
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def configuration
|
14
|
+
@configuration ||= Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def configure
|
18
|
+
yield(configuration)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Configuration
|
23
|
+
attr_writer :helper_module
|
24
|
+
|
25
|
+
def helper_module
|
26
|
+
@helper_module ||= Module.new
|
27
|
+
end
|
28
|
+
end
|
10
29
|
end
|
data/lib/mixpal/tracker.rb
CHANGED
@@ -5,6 +5,8 @@ module Mixpal
|
|
5
5
|
STORAGE_KEY = 'mixpal'
|
6
6
|
|
7
7
|
def initialize(args = {})
|
8
|
+
extend Mixpal.configuration.helper_module
|
9
|
+
|
8
10
|
@events = []
|
9
11
|
@user_updates = []
|
10
12
|
|
@@ -50,8 +52,8 @@ module Mixpal
|
|
50
52
|
end
|
51
53
|
|
52
54
|
if data['user_updates']
|
53
|
-
@user_updates =
|
54
|
-
.map { |u| Mixpal::User.from_store(u) }
|
55
|
+
@user_updates =
|
56
|
+
data['user_updates'].map { |u| Mixpal::User.from_store(u) }
|
55
57
|
end
|
56
58
|
|
57
59
|
session.delete(STORAGE_KEY)
|
data/lib/mixpal/version.rb
CHANGED
@@ -5,6 +5,18 @@ describe Mixpal::Tracker do
|
|
5
5
|
let(:identity) { 'nick' }
|
6
6
|
let(:subject_with_identity) { Mixpal::Tracker.new(identity: identity) }
|
7
7
|
|
8
|
+
context 'with configured helper module' do
|
9
|
+
before do
|
10
|
+
Mixpal.configure do |config|
|
11
|
+
config.helper_module = CustomEventsModule
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'exposes helper module methods on tracker instance' do
|
16
|
+
expect(subject.custom_event).to eq true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
describe '#initialize' do
|
9
21
|
it 'creates an empty set of events' do
|
10
22
|
expect(subject.events).to eq []
|
data/spec/lib/mixpal_spec.rb
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Mixpal do
|
4
|
+
describe '#configure' do
|
5
|
+
before do
|
6
|
+
Mixpal.configure do |config|
|
7
|
+
config.helper_module = CustomEventsModule
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'allows a helper module to be set on Mixpal.configuration' do
|
12
|
+
expect(Mixpal.configuration.helper_module).to be(CustomEventsModule)
|
13
|
+
end
|
14
|
+
end
|
4
15
|
end
|
data/test_app/.gitignore
CHANGED
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- patbenatar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.24.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.24.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.14.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.14.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 3.0.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rb-fsevent
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.9.3
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.9.3
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: awesome_print
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.1.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.1.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: nokogiri
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 1.6.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.6.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: actionpack
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '3.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '3.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: activesupport
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '3.0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '3.0'
|
167
167
|
description: Use Mixpanel's JavaScript library from your backend with ease
|
@@ -171,10 +171,10 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
-
- .gitignore
|
175
|
-
- .rspec
|
176
|
-
- .rubocop.yml
|
177
|
-
- .travis.yml
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- ".rubocop.yml"
|
177
|
+
- ".travis.yml"
|
178
178
|
- Gemfile
|
179
179
|
- Guardfile
|
180
180
|
- LICENSE.txt
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- spec/lib/mixpal/util_spec.rb
|
195
195
|
- spec/lib/mixpal_spec.rb
|
196
196
|
- spec/spec_helper.rb
|
197
|
+
- spec/support/custom_events_module.rb
|
197
198
|
- spec/support/matchers/element_matchers.rb
|
198
199
|
- test_app/.gitignore
|
199
200
|
- test_app/Gemfile
|
@@ -254,17 +255,17 @@ require_paths:
|
|
254
255
|
- lib
|
255
256
|
required_ruby_version: !ruby/object:Gem::Requirement
|
256
257
|
requirements:
|
257
|
-
- -
|
258
|
+
- - ">="
|
258
259
|
- !ruby/object:Gem::Version
|
259
260
|
version: '0'
|
260
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
262
|
requirements:
|
262
|
-
- -
|
263
|
+
- - ">="
|
263
264
|
- !ruby/object:Gem::Version
|
264
265
|
version: '0'
|
265
266
|
requirements: []
|
266
267
|
rubyforge_project:
|
267
|
-
rubygems_version: 2.
|
268
|
+
rubygems_version: 2.4.5
|
268
269
|
signing_key:
|
269
270
|
specification_version: 4
|
270
271
|
summary: As the JavaScript library is Mixpanel's preferred method of usage, Mixpal
|
@@ -278,4 +279,5 @@ test_files:
|
|
278
279
|
- spec/lib/mixpal/util_spec.rb
|
279
280
|
- spec/lib/mixpal_spec.rb
|
280
281
|
- spec/spec_helper.rb
|
282
|
+
- spec/support/custom_events_module.rb
|
281
283
|
- spec/support/matchers/element_matchers.rb
|