mixpal 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fb233388194e4bb65920f2397f440b69c0e84d3e
4
- data.tar.gz: 83af8a3d7aca41e8cbbb049175847f3e74d0be81
2
+ SHA256:
3
+ metadata.gz: 70923329c62f76ee4d6b0796547cdd2e367038940c30d8f5ccb10b044f506d36
4
+ data.tar.gz: 492801097fa1ac2fb85f4600273b2db3fc6e0e8383c9b17112e0302100fc9020
5
5
  SHA512:
6
- metadata.gz: 576d25b01395d3f4e2dda4dfa00df0b93660bb358d914117d596dd472aea60d7caa90828daed689e752716caf0532574f2c78e41b9253e11444eb3c3c9759b51
7
- data.tar.gz: fb5c7d9aacc19f111d8a82fdfdd5b36677542cd9d86a2ff79ccd5fc08415d05306f5d6d861a2ac44be53677718f33a81d88c2f42ff58de127a7ee5901a2b9930
6
+ metadata.gz: b8dbd5bd3051e8edf9ab7b130c0cd6a5af876d52c8fb6992e82c4ae3b22b58eeb726591bffc67368c9cc3c40e60faa2a1f5d5090a3392fe5fc96f374dde1af6e
7
+ data.tar.gz: e32c5e8e487ea31dc875df217e26f962c634978cd07b1d036b97a10f3e7eaa0fb8d446b0e8c00d89c4a5eacce591012400d01e3b541bd98238114a4ea1785aaf
@@ -17,6 +17,7 @@ DoubleNegation:
17
17
  Enabled: false
18
18
 
19
19
  AllCops:
20
+ NewCops: enable
20
21
  Include:
21
22
  - "Rakefile"
22
23
  Exclude:
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem install bundler
2
4
  rvm:
3
- - 2.1.0
4
- - 2.0.0
5
- - 1.9.3
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.1
@@ -0,0 +1,6 @@
1
+ FROM ruby:2.7.1
2
+
3
+ WORKDIR /workspace
4
+
5
+ COPY . .
6
+ RUN bundle install
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Mixpal [![Build Status](https://travis-ci.org/patbenatar/mixpal.svg?branch=master)](https://travis-ci.org/patbenatar/mixpal) [![Code Climate](https://codeclimate.com/github/patbenatar/mixpal/badges/gpa.svg)](https://codeclimate.com/github/patbenatar/mixpal)
1
+ # Mixpal [![Build Status](https://travis-ci.org/philosophie/mixpal.svg?branch=master)](https://travis-ci.org/philosophie/mixpal)
2
2
 
3
3
  As the JavaScript library is Mixpanel's preferred method of usage,
4
4
  Mixpal aims to make it easier to work with from your Rails backend.
@@ -152,3 +152,15 @@ If you anticipate tracking many events or large data sets to Mixpal,
152
152
  1. Commit your changes (`git commit -am 'Add some feature'`)
153
153
  1. Push to the branch (`git push origin feature/my-new-feature`)
154
154
  1. Create new Pull Request
155
+
156
+ ## Releasing
157
+
158
+ Bump `lib/mixpal/version.rb` then build + release with docker-compose. If you
159
+ prefer local development, inspect the Dockerfile to get your local env built.
160
+
161
+ ```
162
+ docker-compose build \
163
+ --build-arg USER_ID=$(id -u) \
164
+ --build-arg GROUP_ID=$(id -g)
165
+ docker-compose run rake release
166
+ ```
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -5,4 +7,4 @@ require 'rubocop/rake_task'
5
7
  RSpec::Core::RakeTask.new(:spec)
6
8
  RuboCop::RakeTask.new
7
9
 
8
- task default: [:spec, :rubocop]
10
+ task default: %i[spec rubocop]
@@ -0,0 +1,14 @@
1
+ version: "3.6"
2
+
3
+ volumes:
4
+ bundle:
5
+
6
+ services:
7
+ gem:
8
+ build: .
9
+ volumes:
10
+ - .:/workspace
11
+ - bundle:/usr/local/bundle
12
+ - $HOME/.ssh:/root/.ssh:ro
13
+ - $HOME/.gitconfig:/root/.gitconfig:ro
14
+ - $HOME/.gem/credentials:/root/.gem/credentials
@@ -4,7 +4,11 @@ module Mixpal
4
4
 
5
5
  included do
6
6
  helper_method :mixpanel
7
- after_filter :store_mixpanel_if_redirecting
7
+ if Rails::VERSION::MAJOR >= 4
8
+ after_action :store_mixpanel_if_redirecting
9
+ else
10
+ after_filter :store_mixpanel_if_redirecting
11
+ end
8
12
 
9
13
  class_attribute :mixpanel_identity_data
10
14
  def self.mixpanel_identity(object_method, attribute_method)
@@ -1,3 +1,3 @@
1
1
  module Mixpal
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -18,15 +18,15 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "bundler", "~> 2"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "pry"
24
- spec.add_development_dependency "rubocop", "~> 0.24.1"
25
- spec.add_development_dependency "rspec", "~> 2.14.0"
26
- spec.add_development_dependency "guard-rspec", "~> 3.0.3"
27
- spec.add_development_dependency "rb-fsevent", "~> 0.9.3"
28
- spec.add_development_dependency "awesome_print", "~> 1.1.0"
29
- spec.add_development_dependency "nokogiri", "~> 1.6.0"
24
+ spec.add_development_dependency "rubocop", "~> 0.91.0"
25
+ spec.add_development_dependency "rspec", "~> 3.9.0"
26
+ spec.add_development_dependency "guard-rspec", "~> 4.7.3"
27
+ spec.add_development_dependency "rb-fsevent", "~> 0.10.4"
28
+ spec.add_development_dependency "awesome_print", "~> 1.8.0"
29
+ spec.add_development_dependency "nokogiri", "~> 1"
30
30
 
31
31
  spec.add_development_dependency "actionpack", ">= 3.0"
32
32
 
@@ -7,7 +7,7 @@ describe Mixpal::Event do
7
7
 
8
8
  describe '#render' do
9
9
  it 'delegates to Util for js_object composition' do
10
- Mixpal::Util.should_receive(:hash_to_js_object_string).with(properties)
10
+ expect(Mixpal::Util).to receive(:hash_to_js_object_string).with(properties)
11
11
  subject.render
12
12
  end
13
13
 
@@ -13,7 +13,7 @@ describe Mixpal::Revenue do
13
13
 
14
14
  describe '#render' do
15
15
  it 'delegates to Util for js_object composition' do
16
- Mixpal::Util.should_receive(:hash_to_js_object_string).with(properties)
16
+ expect(Mixpal::Util).to receive(:hash_to_js_object_string).with(properties)
17
17
  subject.render
18
18
  end
19
19
 
@@ -42,12 +42,12 @@ describe Mixpal::Tracker do
42
42
  describe '#register_user' do
43
43
  it 'sets the alias_user flag so we render the alias call' do
44
44
  subject.register_user(name: 'Nick')
45
- expect(subject.alias_user).to be_true
45
+ expect(subject.alias_user).to be true
46
46
  end
47
47
 
48
48
  it 'delegates to #update_user for tracking user properties' do
49
49
  properties = { name: 'Nick' }
50
- subject.should_receive(:update_user).with(properties)
50
+ expect(subject).to receive(:update_user).with(properties)
51
51
  subject.register_user(properties)
52
52
  end
53
53
  end
@@ -55,7 +55,7 @@ describe Mixpal::Tracker do
55
55
  describe '#update_user' do
56
56
  it 'instantiates a new User object with properties' do
57
57
  properties = { name: 'Nick' }
58
- Mixpal::User.should_receive(:new).with(properties)
58
+ expect(Mixpal::User).to receive(:new).with(properties)
59
59
  subject.update_user(properties)
60
60
  end
61
61
 
@@ -64,7 +64,7 @@ describe Mixpal::Tracker do
64
64
  subject.update_user(name: 'Nick')
65
65
  end.to change(subject.user_updates, :size).by(1)
66
66
 
67
- subject.user_updates.first.should be_an_instance_of(Mixpal::User)
67
+ expect(subject.user_updates.first).to be_an_instance_of(Mixpal::User)
68
68
  end
69
69
  end
70
70
 
@@ -73,7 +73,7 @@ describe Mixpal::Tracker do
73
73
  name = 'Clicked Button'
74
74
  properties = { color: 'Green' }
75
75
 
76
- Mixpal::Event.should_receive(:new).with(name, properties)
76
+ expect(Mixpal::Event).to receive(:new).with(name, properties)
77
77
  subject.track(name, properties)
78
78
  end
79
79
 
@@ -82,14 +82,14 @@ describe Mixpal::Tracker do
82
82
  subject.track('Clicked Button', color: 'Green')
83
83
  end.to change(subject.events, :size).by(1)
84
84
 
85
- subject.events.first.should be_an_instance_of(Mixpal::Event)
85
+ expect(subject.events.first).to be_an_instance_of(Mixpal::Event)
86
86
  end
87
87
  end
88
88
 
89
89
  describe '#track_charge' do
90
90
  it 'instantiates a new Revenue object with properties' do
91
91
  properties = { sku: 'SKU-1010' }
92
- Mixpal::Revenue.should_receive(:new).with(50, properties)
92
+ expect(Mixpal::Revenue).to receive(:new).with(50, properties)
93
93
  subject.track_charge(50, properties)
94
94
  end
95
95
 
@@ -98,7 +98,7 @@ describe Mixpal::Tracker do
98
98
  subject.track_charge(50, sku: 'SKU-1010')
99
99
  end.to change(subject.revenue_updates, :size).by(1)
100
100
 
101
- subject.revenue_updates.first.should be_an_instance_of(Mixpal::Revenue)
101
+ expect(subject.revenue_updates.first).to be_an_instance_of(Mixpal::Revenue)
102
102
  end
103
103
  end
104
104
 
@@ -146,7 +146,7 @@ describe Mixpal::Tracker do
146
146
  end
147
147
 
148
148
  it 'delegates render to the events' do
149
- subject.events.each { |event| event.should_receive :render }
149
+ subject.events.each { |event| expect(event).to receive :render }
150
150
  subject.render
151
151
  end
152
152
 
@@ -163,7 +163,7 @@ describe Mixpal::Tracker do
163
163
  end
164
164
 
165
165
  it 'delegates render to the users' do
166
- subject.user_updates.each { |user| user.should_receive :render }
166
+ subject.user_updates.each { |user| expect(user).to receive :render }
167
167
  subject.render
168
168
  end
169
169
 
@@ -180,7 +180,7 @@ describe Mixpal::Tracker do
180
180
  end
181
181
 
182
182
  it 'delegates render to the revenues' do
183
- subject.revenue_updates.each { |r| r.should_receive :render }
183
+ subject.revenue_updates.each { |r| expect(r).to receive :render }
184
184
  subject.render
185
185
  end
186
186
 
@@ -195,19 +195,19 @@ describe Mixpal::Tracker do
195
195
  describe '#store!' do
196
196
  let(:session) { {} }
197
197
 
198
- def storage_should_include(hash_fragment)
198
+ def expect_storage_to_include(hash_fragment)
199
199
  expect(session[described_class::STORAGE_KEY]).to include hash_fragment
200
200
  end
201
201
 
202
202
  it 'stores the alias_user property' do
203
203
  subject.register_user({})
204
204
  subject.store!(session)
205
- storage_should_include('alias_user' => true)
205
+ expect_storage_to_include('alias_user' => true)
206
206
  end
207
207
 
208
208
  it 'stores the identity' do
209
209
  subject_with_identity.store!(session)
210
- storage_should_include('identity' => identity)
210
+ expect_storage_to_include('identity' => identity)
211
211
  end
212
212
 
213
213
  context 'when events have been tracked' do
@@ -217,13 +217,13 @@ describe Mixpal::Tracker do
217
217
  end
218
218
 
219
219
  it 'delegates composition to the events' do
220
- subject.events.each { |event| event.should_receive :to_store }
220
+ subject.events.each { |event| expect(event).to receive :to_store }
221
221
  subject.store!(session)
222
222
  end
223
223
 
224
224
  it 'stores the events composed hashes in an array' do
225
225
  subject.store!(session)
226
- storage_should_include(
226
+ expect_storage_to_include(
227
227
  'events' => [subject.events[0].to_store, subject.events[1].to_store]
228
228
  )
229
229
  end
@@ -236,14 +236,14 @@ describe Mixpal::Tracker do
236
236
  end
237
237
 
238
238
  it 'delegates composition to the users' do
239
- subject.user_updates.each { |user| user.should_receive :to_store }
239
+ subject.user_updates.each { |user| expect(user).to receive :to_store }
240
240
  subject.store!(session)
241
241
  end
242
242
 
243
243
  it 'stores the users composed hashes in an array' do
244
244
  subject.store!(session)
245
245
 
246
- storage_should_include(
246
+ expect_storage_to_include(
247
247
  'user_updates' => [
248
248
  subject.user_updates[0].to_store,
249
249
  subject.user_updates[1].to_store
@@ -274,7 +274,7 @@ describe Mixpal::Tracker do
274
274
  end
275
275
 
276
276
  it 'delegates event restoration to the Event class' do
277
- Mixpal::Event.should_receive(:from_store)
277
+ expect(Mixpal::Event).to receive(:from_store)
278
278
  .with(old_tracker.events.first.to_store)
279
279
 
280
280
  subject.restore!(session)
@@ -12,7 +12,7 @@ describe Mixpal::User do
12
12
 
13
13
  describe '#render' do
14
14
  it 'delegates to Util for js_object composition' do
15
- Mixpal::Util.should_receive(:hash_to_js_object_string).with(properties)
15
+ expect(Mixpal::Util).to receive(:hash_to_js_object_string).with(properties)
16
16
  subject.render
17
17
  end
18
18
 
@@ -6,7 +6,6 @@ require 'mixpal'
6
6
  Dir['./spec/support/**/*.rb'].each { |f| require f }
7
7
 
8
8
  RSpec.configure do |config|
9
- config.treat_symbols_as_metadata_keys_with_true_values = true
10
9
  config.run_all_when_everything_filtered = true
11
10
  config.filter_run :focus
12
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixpal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - patbenatar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-10 00:00:00.000000000 Z
12
+ date: 2020-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.3'
20
+ version: '2'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.3'
27
+ version: '2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,84 +59,84 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.24.1
62
+ version: 0.91.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.24.1
69
+ version: 0.91.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 2.14.0
76
+ version: 3.9.0
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 2.14.0
83
+ version: 3.9.0
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: guard-rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 3.0.3
90
+ version: 4.7.3
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 3.0.3
97
+ version: 4.7.3
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rb-fsevent
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.9.3
104
+ version: 0.10.4
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.9.3
111
+ version: 0.10.4
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: awesome_print
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.1.0
118
+ version: 1.8.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 1.1.0
125
+ version: 1.8.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: nokogiri
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 1.6.0
132
+ version: '1'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 1.6.0
139
+ version: '1'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: actionpack
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -176,11 +176,13 @@ files:
176
176
  - ".rspec"
177
177
  - ".rubocop.yml"
178
178
  - ".travis.yml"
179
+ - Dockerfile
179
180
  - Gemfile
180
181
  - Guardfile
181
182
  - LICENSE.txt
182
183
  - README.md
183
184
  - Rakefile
185
+ - docker-compose.yml
184
186
  - lib/mixpal.rb
185
187
  - lib/mixpal/event.rb
186
188
  - lib/mixpal/integration.rb
@@ -267,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
269
  - !ruby/object:Gem::Version
268
270
  version: '0'
269
271
  requirements: []
270
- rubyforge_project:
271
- rubygems_version: 2.4.5
272
+ rubygems_version: 3.1.2
272
273
  signing_key:
273
274
  specification_version: 4
274
275
  summary: As the JavaScript library is Mixpanel's preferred method of usage, Mixpal