vanity 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linting.yml +28 -0
- data/.github/workflows/test.yml +3 -6
- data/.rubocop.yml +114 -0
- data/.rubocop_todo.yml +67 -0
- data/Appraisals +9 -31
- data/CHANGELOG +5 -0
- data/Gemfile +7 -3
- data/Gemfile.lock +31 -3
- data/README.md +4 -9
- data/Rakefile +25 -24
- data/bin/vanity +1 -1
- data/doc/configuring.textile +1 -0
- data/gemfiles/rails52.gemfile +6 -3
- data/gemfiles/rails52.gemfile.lock +34 -9
- data/gemfiles/rails60.gemfile +6 -3
- data/gemfiles/rails60.gemfile.lock +34 -9
- data/gemfiles/rails61.gemfile +6 -3
- data/gemfiles/rails61.gemfile.lock +34 -9
- data/lib/generators/vanity/migration_generator.rb +5 -7
- data/lib/vanity/adapters/abstract_adapter.rb +43 -45
- data/lib/vanity/adapters/active_record_adapter.rb +30 -30
- data/lib/vanity/adapters/mock_adapter.rb +14 -18
- data/lib/vanity/adapters/mongodb_adapter.rb +73 -69
- data/lib/vanity/adapters/redis_adapter.rb +19 -27
- data/lib/vanity/adapters.rb +1 -1
- data/lib/vanity/autoconnect.rb +6 -7
- data/lib/vanity/commands/list.rb +7 -7
- data/lib/vanity/commands/report.rb +18 -22
- data/lib/vanity/configuration.rb +19 -19
- data/lib/vanity/connection.rb +12 -14
- data/lib/vanity/experiment/ab_test.rb +82 -70
- data/lib/vanity/experiment/alternative.rb +3 -5
- data/lib/vanity/experiment/base.rb +24 -19
- data/lib/vanity/experiment/bayesian_bandit_score.rb +7 -13
- data/lib/vanity/experiment/definition.rb +6 -6
- data/lib/vanity/frameworks/rails.rb +39 -39
- data/lib/vanity/frameworks.rb +2 -2
- data/lib/vanity/helpers.rb +1 -1
- data/lib/vanity/metric/active_record.rb +21 -19
- data/lib/vanity/metric/base.rb +22 -23
- data/lib/vanity/metric/google_analytics.rb +6 -9
- data/lib/vanity/metric/remote.rb +3 -5
- data/lib/vanity/playground.rb +3 -6
- data/lib/vanity/vanity.rb +8 -12
- data/lib/vanity/version.rb +1 -1
- data/test/adapters/active_record_adapter_test.rb +1 -5
- data/test/adapters/mock_adapter_test.rb +0 -2
- data/test/adapters/mongodb_adapter_test.rb +1 -5
- data/test/adapters/redis_adapter_test.rb +2 -3
- data/test/adapters/shared_tests.rb +9 -12
- data/test/autoconnect_test.rb +3 -3
- data/test/cli_test.rb +0 -1
- data/test/configuration_test.rb +18 -34
- data/test/connection_test.rb +3 -3
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/controllers/use_vanity_controller.rb +12 -8
- data/test/dummy/app/mailers/vanity_mailer.rb +3 -3
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/boot.rb +3 -3
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +0 -1
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config.ru +1 -1
- data/test/dummy/script/rails +2 -2
- data/test/experiment/ab_test.rb +148 -154
- data/test/experiment/base_test.rb +48 -32
- data/test/frameworks/rails/action_controller_test.rb +25 -25
- data/test/frameworks/rails/action_mailer_test.rb +2 -2
- data/test/frameworks/rails/action_view_test.rb +5 -6
- data/test/frameworks/rails/rails_test.rb +147 -181
- data/test/helper_test.rb +2 -2
- data/test/metric/active_record_test.rb +174 -212
- data/test/metric/base_test.rb +21 -46
- data/test/metric/google_analytics_test.rb +17 -25
- data/test/metric/remote_test.rb +7 -10
- data/test/playground_test.rb +7 -14
- data/test/templates_test.rb +16 -20
- data/test/test_helper.rb +28 -29
- data/test/vanity_test.rb +4 -10
- data/test/web/rails/dashboard_test.rb +21 -21
- data/vanity.gemspec +8 -7
- metadata +28 -30
- data/gemfiles/rails42.gemfile +0 -33
- data/gemfiles/rails42.gemfile.lock +0 -265
- data/gemfiles/rails42_protected_attributes.gemfile +0 -34
- data/gemfiles/rails42_protected_attributes.gemfile.lock +0 -264
- data/gemfiles/rails51.gemfile +0 -33
- data/gemfiles/rails51.gemfile.lock +0 -285
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: ..
|
9
9
|
specs:
|
10
|
-
vanity (
|
10
|
+
vanity (4.0.0)
|
11
11
|
i18n
|
12
12
|
|
13
13
|
GEM
|
@@ -65,6 +65,7 @@ GEM
|
|
65
65
|
rake
|
66
66
|
thor (>= 0.14.0)
|
67
67
|
arel (9.0.0)
|
68
|
+
ast (2.4.2)
|
68
69
|
blankslate (2.1.2.4)
|
69
70
|
bson (4.3.0)
|
70
71
|
bson (4.3.0-java)
|
@@ -82,7 +83,6 @@ GEM
|
|
82
83
|
crack (0.4.3)
|
83
84
|
safe_yaml (~> 1.0.0)
|
84
85
|
crass (1.0.4)
|
85
|
-
daemon_controller (1.2.0)
|
86
86
|
erubi (1.7.1)
|
87
87
|
execjs (2.7.0)
|
88
88
|
fakefs (0.18.0)
|
@@ -162,11 +162,12 @@ GEM
|
|
162
162
|
racc (~> 1.4)
|
163
163
|
octokit (4.9.0)
|
164
164
|
sawyer (~> 0.8.0, >= 0.5.3)
|
165
|
+
parallel (1.21.0)
|
166
|
+
parser (3.1.1.0)
|
167
|
+
ast (~> 2.4.1)
|
165
168
|
parslet (1.5.0)
|
166
169
|
blankslate (~> 2.0)
|
167
|
-
passenger (
|
168
|
-
daemon_controller (>= 1.0.0)
|
169
|
-
fastthread (>= 1.0.1)
|
170
|
+
passenger (6.0.12)
|
170
171
|
rack
|
171
172
|
rake (>= 0.8.1)
|
172
173
|
posix-spawn (0.3.13)
|
@@ -183,7 +184,7 @@ GEM
|
|
183
184
|
yajl-ruby (~> 1.2.0)
|
184
185
|
racc (1.6.0)
|
185
186
|
racc (1.6.0-java)
|
186
|
-
rack (2.
|
187
|
+
rack (2.2.3)
|
187
188
|
rack-test (1.1.0)
|
188
189
|
rack (>= 1.0, < 3)
|
189
190
|
rails (5.2.0)
|
@@ -210,7 +211,8 @@ GEM
|
|
210
211
|
method_source
|
211
212
|
rake (>= 0.8.7)
|
212
213
|
thor (>= 0.18.1, < 2.0)
|
213
|
-
|
214
|
+
rainbow (3.1.1)
|
215
|
+
rake (13.0.6)
|
214
216
|
rb-fsevent (0.10.3)
|
215
217
|
rb-inotify (0.9.10)
|
216
218
|
ffi (>= 0.5.0, < 2)
|
@@ -218,6 +220,25 @@ GEM
|
|
218
220
|
redis (4.0.1)
|
219
221
|
redis-namespace (1.6.0)
|
220
222
|
redis (>= 3.0.4)
|
223
|
+
regexp_parser (2.2.1)
|
224
|
+
rexml (3.2.5)
|
225
|
+
rubocop (1.25.1)
|
226
|
+
parallel (~> 1.10)
|
227
|
+
parser (>= 3.1.0.0)
|
228
|
+
rainbow (>= 2.2.2, < 4.0)
|
229
|
+
regexp_parser (>= 1.8, < 3.0)
|
230
|
+
rexml
|
231
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
232
|
+
ruby-progressbar (~> 1.7)
|
233
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
234
|
+
rubocop-ast (1.15.2)
|
235
|
+
parser (>= 3.0.1.1)
|
236
|
+
rubocop-performance (1.13.2)
|
237
|
+
rubocop (>= 1.7.0, < 2.0)
|
238
|
+
rubocop-ast (>= 0.4.0)
|
239
|
+
rubocop-rspec (2.8.0)
|
240
|
+
rubocop (~> 1.19)
|
241
|
+
ruby-progressbar (1.11.0)
|
221
242
|
ruby_dep (1.5.0)
|
222
243
|
rubystats (0.3.0)
|
223
244
|
safe_yaml (1.0.4)
|
@@ -247,6 +268,7 @@ GEM
|
|
247
268
|
parslet (~> 1.5.0)
|
248
269
|
tzinfo (1.2.5)
|
249
270
|
thread_safe (~> 0.1)
|
271
|
+
unicode-display_width (2.1.0)
|
250
272
|
webmock (3.4.2)
|
251
273
|
addressable (>= 2.3.6)
|
252
274
|
crack (>= 0.3.2)
|
@@ -277,13 +299,16 @@ DEPENDENCIES
|
|
277
299
|
minitest (>= 4.2)
|
278
300
|
mocha (~> 1.0)
|
279
301
|
mongo (~> 2.1)
|
280
|
-
passenger
|
302
|
+
passenger
|
281
303
|
pry
|
282
304
|
rack
|
283
305
|
rails (~> 5.2.0)
|
284
306
|
rake
|
285
307
|
redis (>= 3.2.1)
|
286
308
|
redis-namespace (>= 1.1.0)
|
309
|
+
rubocop
|
310
|
+
rubocop-performance
|
311
|
+
rubocop-rspec
|
287
312
|
rubystats (>= 0.2.5)
|
288
313
|
sqlite3 (~> 1.3.10)
|
289
314
|
timecop
|
@@ -292,4 +317,4 @@ DEPENDENCIES
|
|
292
317
|
yard
|
293
318
|
|
294
319
|
BUNDLED WITH
|
295
|
-
1.17.
|
320
|
+
1.17.3
|
data/gemfiles/rails60.gemfile
CHANGED
@@ -3,26 +3,29 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rack"
|
6
|
+
gem "mongo", "~> 2.1"
|
6
7
|
gem "redis", ">= 3.2.1"
|
7
8
|
gem "redis-namespace", ">= 1.1.0"
|
8
|
-
gem "mongo", "~> 2.1"
|
9
9
|
gem "integration", "<= 0.1.0"
|
10
10
|
gem "rubystats", ">= 0.2.5"
|
11
11
|
gem "garb", "< 0.9.2", require: false
|
12
12
|
gem "mocha", "~> 1.0", require: false
|
13
13
|
gem "rails", "~>5.2.0"
|
14
14
|
gem "fastthread", platforms: :mri_20, git: "https://github.com/zoltankiss/fastthread.git"
|
15
|
-
gem "passenger"
|
15
|
+
gem "passenger"
|
16
16
|
|
17
17
|
group :development do
|
18
18
|
gem "rake"
|
19
19
|
gem "RedCloth"
|
20
20
|
gem "yard"
|
21
|
+
gem "rubocop"
|
22
|
+
gem "rubocop-performance"
|
23
|
+
gem "rubocop-rspec"
|
21
24
|
end
|
22
25
|
|
23
26
|
platforms :ruby do
|
24
|
-
gem "sqlite3", "~> 1.3.10"
|
25
27
|
gem "jekyll", "~> 2.5.3"
|
28
|
+
gem "sqlite3", "~> 1.3.10"
|
26
29
|
end
|
27
30
|
|
28
31
|
platforms :jruby do
|
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: ..
|
9
9
|
specs:
|
10
|
-
vanity (
|
10
|
+
vanity (4.0.0)
|
11
11
|
i18n
|
12
12
|
|
13
13
|
GEM
|
@@ -65,6 +65,7 @@ GEM
|
|
65
65
|
rake
|
66
66
|
thor (>= 0.14.0)
|
67
67
|
arel (9.0.0)
|
68
|
+
ast (2.4.2)
|
68
69
|
blankslate (2.1.2.4)
|
69
70
|
bson (4.3.0)
|
70
71
|
bson (4.3.0-java)
|
@@ -82,7 +83,6 @@ GEM
|
|
82
83
|
crack (0.4.3)
|
83
84
|
safe_yaml (~> 1.0.0)
|
84
85
|
crass (1.0.4)
|
85
|
-
daemon_controller (1.2.0)
|
86
86
|
erubi (1.7.1)
|
87
87
|
execjs (2.7.0)
|
88
88
|
fakefs (0.18.0)
|
@@ -160,11 +160,12 @@ GEM
|
|
160
160
|
racc (~> 1.4)
|
161
161
|
octokit (4.9.0)
|
162
162
|
sawyer (~> 0.8.0, >= 0.5.3)
|
163
|
+
parallel (1.21.0)
|
164
|
+
parser (3.1.1.0)
|
165
|
+
ast (~> 2.4.1)
|
163
166
|
parslet (1.5.0)
|
164
167
|
blankslate (~> 2.0)
|
165
|
-
passenger (
|
166
|
-
daemon_controller (>= 1.0.0)
|
167
|
-
fastthread (>= 1.0.1)
|
168
|
+
passenger (6.0.12)
|
168
169
|
rack
|
169
170
|
rake (>= 0.8.1)
|
170
171
|
posix-spawn (0.3.13)
|
@@ -181,7 +182,7 @@ GEM
|
|
181
182
|
yajl-ruby (~> 1.2.0)
|
182
183
|
racc (1.6.0)
|
183
184
|
racc (1.6.0-java)
|
184
|
-
rack (2.
|
185
|
+
rack (2.2.3)
|
185
186
|
rack-test (1.1.0)
|
186
187
|
rack (>= 1.0, < 3)
|
187
188
|
rails (5.2.0)
|
@@ -208,7 +209,8 @@ GEM
|
|
208
209
|
method_source
|
209
210
|
rake (>= 0.8.7)
|
210
211
|
thor (>= 0.18.1, < 2.0)
|
211
|
-
|
212
|
+
rainbow (3.1.1)
|
213
|
+
rake (13.0.6)
|
212
214
|
rb-fsevent (0.10.3)
|
213
215
|
rb-inotify (0.9.10)
|
214
216
|
ffi (>= 0.5.0, < 2)
|
@@ -216,6 +218,25 @@ GEM
|
|
216
218
|
redis (4.0.1)
|
217
219
|
redis-namespace (1.6.0)
|
218
220
|
redis (>= 3.0.4)
|
221
|
+
regexp_parser (2.2.1)
|
222
|
+
rexml (3.2.5)
|
223
|
+
rubocop (1.25.1)
|
224
|
+
parallel (~> 1.10)
|
225
|
+
parser (>= 3.1.0.0)
|
226
|
+
rainbow (>= 2.2.2, < 4.0)
|
227
|
+
regexp_parser (>= 1.8, < 3.0)
|
228
|
+
rexml
|
229
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
230
|
+
ruby-progressbar (~> 1.7)
|
231
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
232
|
+
rubocop-ast (1.15.2)
|
233
|
+
parser (>= 3.0.1.1)
|
234
|
+
rubocop-performance (1.13.2)
|
235
|
+
rubocop (>= 1.7.0, < 2.0)
|
236
|
+
rubocop-ast (>= 0.4.0)
|
237
|
+
rubocop-rspec (2.8.0)
|
238
|
+
rubocop (~> 1.19)
|
239
|
+
ruby-progressbar (1.11.0)
|
219
240
|
ruby_dep (1.5.0)
|
220
241
|
rubystats (0.3.0)
|
221
242
|
safe_yaml (1.0.4)
|
@@ -245,6 +266,7 @@ GEM
|
|
245
266
|
parslet (~> 1.5.0)
|
246
267
|
tzinfo (1.2.5)
|
247
268
|
thread_safe (~> 0.1)
|
269
|
+
unicode-display_width (2.1.0)
|
248
270
|
webmock (3.4.2)
|
249
271
|
addressable (>= 2.3.6)
|
250
272
|
crack (>= 0.3.2)
|
@@ -275,13 +297,16 @@ DEPENDENCIES
|
|
275
297
|
minitest (>= 4.2)
|
276
298
|
mocha (~> 1.0)
|
277
299
|
mongo (~> 2.1)
|
278
|
-
passenger
|
300
|
+
passenger
|
279
301
|
pry
|
280
302
|
rack
|
281
303
|
rails (~> 5.2.0)
|
282
304
|
rake
|
283
305
|
redis (>= 3.2.1)
|
284
306
|
redis-namespace (>= 1.1.0)
|
307
|
+
rubocop
|
308
|
+
rubocop-performance
|
309
|
+
rubocop-rspec
|
285
310
|
rubystats (>= 0.2.5)
|
286
311
|
sqlite3 (~> 1.3.10)
|
287
312
|
timecop
|
@@ -290,4 +315,4 @@ DEPENDENCIES
|
|
290
315
|
yard
|
291
316
|
|
292
317
|
BUNDLED WITH
|
293
|
-
1.17.
|
318
|
+
1.17.3
|
data/gemfiles/rails61.gemfile
CHANGED
@@ -3,26 +3,29 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rack"
|
6
|
+
gem "mongo", "~> 2.1"
|
6
7
|
gem "redis", ">= 3.2.1"
|
7
8
|
gem "redis-namespace", ">= 1.1.0"
|
8
|
-
gem "mongo", "~> 2.1"
|
9
9
|
gem "integration", "<= 0.1.0"
|
10
10
|
gem "rubystats", ">= 0.2.5"
|
11
11
|
gem "garb", "< 0.9.2", require: false
|
12
12
|
gem "mocha", "~> 1.0", require: false
|
13
13
|
gem "rails", "~>5.2.0"
|
14
14
|
gem "fastthread", platforms: :mri_20, git: "https://github.com/zoltankiss/fastthread.git"
|
15
|
-
gem "passenger"
|
15
|
+
gem "passenger"
|
16
16
|
|
17
17
|
group :development do
|
18
18
|
gem "rake"
|
19
19
|
gem "RedCloth"
|
20
20
|
gem "yard"
|
21
|
+
gem "rubocop"
|
22
|
+
gem "rubocop-performance"
|
23
|
+
gem "rubocop-rspec"
|
21
24
|
end
|
22
25
|
|
23
26
|
platforms :ruby do
|
24
|
-
gem "sqlite3", "~> 1.3.10"
|
25
27
|
gem "jekyll", "~> 2.5.3"
|
28
|
+
gem "sqlite3", "~> 1.3.10"
|
26
29
|
end
|
27
30
|
|
28
31
|
platforms :jruby do
|
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: ..
|
9
9
|
specs:
|
10
|
-
vanity (
|
10
|
+
vanity (4.0.0)
|
11
11
|
i18n
|
12
12
|
|
13
13
|
GEM
|
@@ -65,6 +65,7 @@ GEM
|
|
65
65
|
rake
|
66
66
|
thor (>= 0.14.0)
|
67
67
|
arel (9.0.0)
|
68
|
+
ast (2.4.2)
|
68
69
|
blankslate (2.1.2.4)
|
69
70
|
bson (4.3.0)
|
70
71
|
bson (4.3.0-java)
|
@@ -82,7 +83,6 @@ GEM
|
|
82
83
|
crack (0.4.3)
|
83
84
|
safe_yaml (~> 1.0.0)
|
84
85
|
crass (1.0.4)
|
85
|
-
daemon_controller (1.2.0)
|
86
86
|
erubi (1.7.1)
|
87
87
|
execjs (2.7.0)
|
88
88
|
fakefs (0.18.0)
|
@@ -160,11 +160,12 @@ GEM
|
|
160
160
|
racc (~> 1.4)
|
161
161
|
octokit (4.9.0)
|
162
162
|
sawyer (~> 0.8.0, >= 0.5.3)
|
163
|
+
parallel (1.21.0)
|
164
|
+
parser (3.1.1.0)
|
165
|
+
ast (~> 2.4.1)
|
163
166
|
parslet (1.5.0)
|
164
167
|
blankslate (~> 2.0)
|
165
|
-
passenger (
|
166
|
-
daemon_controller (>= 1.0.0)
|
167
|
-
fastthread (>= 1.0.1)
|
168
|
+
passenger (6.0.12)
|
168
169
|
rack
|
169
170
|
rake (>= 0.8.1)
|
170
171
|
posix-spawn (0.3.13)
|
@@ -181,7 +182,7 @@ GEM
|
|
181
182
|
yajl-ruby (~> 1.2.0)
|
182
183
|
racc (1.6.0)
|
183
184
|
racc (1.6.0-java)
|
184
|
-
rack (2.
|
185
|
+
rack (2.2.3)
|
185
186
|
rack-test (1.1.0)
|
186
187
|
rack (>= 1.0, < 3)
|
187
188
|
rails (5.2.0)
|
@@ -208,7 +209,8 @@ GEM
|
|
208
209
|
method_source
|
209
210
|
rake (>= 0.8.7)
|
210
211
|
thor (>= 0.18.1, < 2.0)
|
211
|
-
|
212
|
+
rainbow (3.1.1)
|
213
|
+
rake (13.0.6)
|
212
214
|
rb-fsevent (0.10.3)
|
213
215
|
rb-inotify (0.9.10)
|
214
216
|
ffi (>= 0.5.0, < 2)
|
@@ -216,6 +218,25 @@ GEM
|
|
216
218
|
redis (4.0.1)
|
217
219
|
redis-namespace (1.6.0)
|
218
220
|
redis (>= 3.0.4)
|
221
|
+
regexp_parser (2.2.1)
|
222
|
+
rexml (3.2.5)
|
223
|
+
rubocop (1.25.1)
|
224
|
+
parallel (~> 1.10)
|
225
|
+
parser (>= 3.1.0.0)
|
226
|
+
rainbow (>= 2.2.2, < 4.0)
|
227
|
+
regexp_parser (>= 1.8, < 3.0)
|
228
|
+
rexml
|
229
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
230
|
+
ruby-progressbar (~> 1.7)
|
231
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
232
|
+
rubocop-ast (1.15.2)
|
233
|
+
parser (>= 3.0.1.1)
|
234
|
+
rubocop-performance (1.13.2)
|
235
|
+
rubocop (>= 1.7.0, < 2.0)
|
236
|
+
rubocop-ast (>= 0.4.0)
|
237
|
+
rubocop-rspec (2.8.0)
|
238
|
+
rubocop (~> 1.19)
|
239
|
+
ruby-progressbar (1.11.0)
|
219
240
|
ruby_dep (1.5.0)
|
220
241
|
rubystats (0.3.0)
|
221
242
|
safe_yaml (1.0.4)
|
@@ -245,6 +266,7 @@ GEM
|
|
245
266
|
parslet (~> 1.5.0)
|
246
267
|
tzinfo (1.2.5)
|
247
268
|
thread_safe (~> 0.1)
|
269
|
+
unicode-display_width (2.1.0)
|
248
270
|
webmock (3.4.2)
|
249
271
|
addressable (>= 2.3.6)
|
250
272
|
crack (>= 0.3.2)
|
@@ -275,13 +297,16 @@ DEPENDENCIES
|
|
275
297
|
minitest (>= 4.2)
|
276
298
|
mocha (~> 1.0)
|
277
299
|
mongo (~> 2.1)
|
278
|
-
passenger
|
300
|
+
passenger
|
279
301
|
pry
|
280
302
|
rack
|
281
303
|
rails (~> 5.2.0)
|
282
304
|
rake
|
283
305
|
redis (>= 3.2.1)
|
284
306
|
redis-namespace (>= 1.1.0)
|
307
|
+
rubocop
|
308
|
+
rubocop-performance
|
309
|
+
rubocop-rspec
|
285
310
|
rubystats (>= 0.2.5)
|
286
311
|
sqlite3 (~> 1.3.10)
|
287
312
|
timecop
|
@@ -290,4 +315,4 @@ DEPENDENCIES
|
|
290
315
|
yard
|
291
316
|
|
292
317
|
BUNDLED WITH
|
293
|
-
1.17.
|
318
|
+
1.17.3
|
@@ -4,16 +4,16 @@ require 'rails/generators/active_record'
|
|
4
4
|
|
5
5
|
class VanityGenerator < Rails::Generators::Base
|
6
6
|
include Rails::Generators::Migration
|
7
|
-
source_root File.expand_path('
|
7
|
+
source_root File.expand_path('../templates', __dir__)
|
8
8
|
|
9
9
|
def self.next_migration_number(path)
|
10
10
|
::ActiveRecord::Generators::Base.next_migration_number(path)
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_migration_file
|
14
|
-
migration_template "vanity_migration.rb.erb", destination("vanity_migration.rb"), :migration_version
|
15
|
-
migration_template "add_unique_indexes_migration.rb.erb", destination("add_vanity_unique_indexes.rb"), :migration_version
|
16
|
-
migration_template "add_participants_unique_index_migration.rb.erb", destination("add_participants_unique_index_migration.rb"), :migration_version
|
14
|
+
migration_template "vanity_migration.rb.erb", destination("vanity_migration.rb"), migration_version: migration_version
|
15
|
+
migration_template "add_unique_indexes_migration.rb.erb", destination("add_vanity_unique_indexes.rb"), migration_version: migration_version
|
16
|
+
migration_template "add_participants_unique_index_migration.rb.erb", destination("add_participants_unique_index_migration.rb"), migration_version: migration_version
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -27,8 +27,6 @@ class VanityGenerator < Rails::Generators::Base
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def migration_version
|
30
|
-
if versioned?
|
31
|
-
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
32
|
-
end
|
30
|
+
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" if versioned?
|
33
31
|
end
|
34
32
|
end
|
@@ -21,100 +21,98 @@ module Vanity
|
|
21
21
|
def flushdb
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
24
|
# -- Metrics --
|
26
25
|
|
27
26
|
# Return when metric was last updated.
|
28
|
-
def get_metric_last_update_at(
|
29
|
-
|
27
|
+
def get_metric_last_update_at(_metric)
|
28
|
+
raise "Not implemented"
|
30
29
|
end
|
31
30
|
|
32
31
|
# Track metric data.
|
33
|
-
def metric_track(
|
34
|
-
|
32
|
+
def metric_track(_metric, _timestamp, _identity, _values)
|
33
|
+
raise "Not implemented"
|
35
34
|
end
|
36
35
|
|
37
36
|
# Returns all the metric values between from and to time instances
|
38
37
|
# (inclusive). Returns pairs of date and total count for that date.
|
39
|
-
def metric_values(
|
40
|
-
|
38
|
+
def metric_values(_metric, _from, _to)
|
39
|
+
raise "Not implemented"
|
41
40
|
end
|
42
41
|
|
43
42
|
# Deletes all information about this metric.
|
44
|
-
def destroy_metric(
|
45
|
-
|
43
|
+
def destroy_metric(_metric)
|
44
|
+
raise "Not implemented"
|
46
45
|
end
|
47
46
|
|
48
|
-
|
49
47
|
# -- Experiments --
|
50
48
|
|
51
|
-
def experiment_persisted?(
|
52
|
-
|
49
|
+
def experiment_persisted?(_experiment)
|
50
|
+
raise "Not implemented"
|
53
51
|
end
|
54
52
|
|
55
53
|
# Store when experiment was created (do not write over existing value).
|
56
|
-
def set_experiment_created_at(
|
57
|
-
|
54
|
+
def set_experiment_created_at(_experiment, _time)
|
55
|
+
raise "Not implemented"
|
58
56
|
end
|
59
57
|
|
60
58
|
# Return when experiment was created.
|
61
|
-
def get_experiment_created_at(
|
62
|
-
|
59
|
+
def get_experiment_created_at(_experiment)
|
60
|
+
raise "Not implemented"
|
63
61
|
end
|
64
62
|
|
65
63
|
# Returns true if experiment completed.
|
66
|
-
def is_experiment_completed?(
|
67
|
-
|
64
|
+
def is_experiment_completed?(_experiment) # rubocop:todo Naming/PredicateName
|
65
|
+
raise "Not implemented"
|
68
66
|
end
|
69
67
|
|
70
68
|
# Store whether an experiment is enabled or not
|
71
|
-
def set_experiment_enabled(
|
72
|
-
|
69
|
+
def set_experiment_enabled(_experiment, _enabled)
|
70
|
+
raise "Not implemented"
|
73
71
|
end
|
74
72
|
|
75
73
|
# Returns true if experiment is enabled, the default (Vanity.configuration.experiments_start_enabled) is true.
|
76
74
|
# (*except for mock_adapter, where default is true for testing)
|
77
|
-
def is_experiment_enabled?(
|
78
|
-
|
75
|
+
def is_experiment_enabled?(_experiment) # rubocop:todo Naming/PredicateName
|
76
|
+
raise "Not implemented"
|
79
77
|
end
|
80
78
|
|
81
79
|
# Returns counts for given A/B experiment and alternative (by index).
|
82
80
|
# Returns hash with values for the keys :participants, :converted and
|
83
81
|
# :conversions.
|
84
|
-
def ab_counts(
|
85
|
-
|
82
|
+
def ab_counts(_experiment, _alternative)
|
83
|
+
raise "Not implemented"
|
86
84
|
end
|
87
85
|
|
88
86
|
# Pick particular alternative (by index) to show to this particular
|
89
87
|
# participant (by identity).
|
90
|
-
def ab_show(
|
91
|
-
|
88
|
+
def ab_show(_experiment, _identity, _alternative)
|
89
|
+
raise "Not implemented"
|
92
90
|
end
|
93
91
|
|
94
92
|
# Indicates which alternative to show to this participant. See #ab_show.
|
95
|
-
def ab_showing(
|
96
|
-
|
93
|
+
def ab_showing(_experiment, _identity)
|
94
|
+
raise "Not implemented"
|
97
95
|
end
|
98
96
|
|
99
97
|
# Cancels previously set association between identity and alternative. See
|
100
98
|
# #ab_show.
|
101
|
-
def ab_not_showing(
|
102
|
-
|
99
|
+
def ab_not_showing(_experiment, _identity)
|
100
|
+
raise "Not implemented"
|
103
101
|
end
|
104
102
|
|
105
103
|
# Records a participant in this experiment for the given alternative.
|
106
|
-
def ab_add_participant(
|
107
|
-
|
104
|
+
def ab_add_participant(_experiment, _alternative, _identity)
|
105
|
+
raise "Not implemented"
|
108
106
|
end
|
109
107
|
|
110
108
|
# Determines if a participant already has seen this alternative in this experiment.
|
111
|
-
def ab_seen(
|
112
|
-
|
109
|
+
def ab_seen(_experiment, _identity, _assignment)
|
110
|
+
raise "Not implemented"
|
113
111
|
end
|
114
112
|
|
115
113
|
# Determines what alternative a participant has already been given, if any
|
116
|
-
def ab_assigned(
|
117
|
-
|
114
|
+
def ab_assigned(_experiment, _identity)
|
115
|
+
raise "Not implemented"
|
118
116
|
end
|
119
117
|
|
120
118
|
# Records a conversion in this experiment for the given alternative.
|
@@ -122,31 +120,31 @@ module Vanity
|
|
122
120
|
# true, add particpant if not already recorded for this experiment. If
|
123
121
|
# implicit is false (default), only add conversion is participant
|
124
122
|
# previously recorded as participating in this experiment.
|
125
|
-
def ab_add_conversion(
|
126
|
-
|
123
|
+
def ab_add_conversion(_experiment, _alternative, _identity, _count = 1, _implicit = false)
|
124
|
+
raise "Not implemented"
|
127
125
|
end
|
128
126
|
|
129
127
|
# Returns the outcome of this expriment (if set), the index of a
|
130
128
|
# particular alternative.
|
131
|
-
def ab_get_outcome(
|
132
|
-
|
129
|
+
def ab_get_outcome(_experiment)
|
130
|
+
raise "Not implemented"
|
133
131
|
end
|
134
132
|
|
135
133
|
# Sets the outcome of this experiment to a particular alternative.
|
136
|
-
def ab_set_outcome(
|
137
|
-
|
134
|
+
def ab_set_outcome(_experiment, _alternative = 0)
|
135
|
+
raise "Not implemented"
|
138
136
|
end
|
139
137
|
|
140
138
|
# Deletes all information about this experiment.
|
141
|
-
def destroy_experiment(
|
142
|
-
|
139
|
+
def destroy_experiment(_experiment)
|
140
|
+
raise "Not implemented"
|
143
141
|
end
|
144
142
|
|
145
143
|
private
|
146
144
|
|
147
145
|
def with_ab_seen_deprecation(experiment, identity, alternative)
|
148
146
|
if alternative.respond_to?(:id)
|
149
|
-
Vanity.configuration.logger.warn(
|
147
|
+
Vanity.configuration.logger.warn('Deprecated: #ab_seen should be passed the alternative id, not an Alternative instance')
|
150
148
|
yield experiment, identity, alternative.id
|
151
149
|
else
|
152
150
|
yield experiment, identity, alternative
|