split 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.eslintrc +1 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.rspec +1 -0
- data/.rubocop.yml +6 -1155
- data/.rubocop_todo.yml +679 -0
- data/.travis.yml +27 -20
- data/Appraisals +4 -0
- data/CHANGELOG.md +75 -0
- data/CODE_OF_CONDUCT.md +3 -3
- data/Gemfile +1 -0
- data/README.md +39 -22
- data/Rakefile +1 -0
- data/gemfiles/6.0.gemfile +9 -0
- data/lib/split/algorithms/block_randomization.rb +1 -0
- data/lib/split/alternative.rb +3 -3
- data/lib/split/combined_experiments_helper.rb +2 -2
- data/lib/split/configuration.rb +9 -2
- data/lib/split/dashboard/helpers.rb +2 -2
- data/lib/split/dashboard/pagination_helpers.rb +3 -4
- data/lib/split/dashboard/views/layout.erb +1 -1
- data/lib/split/dashboard.rb +4 -1
- data/lib/split/engine.rb +6 -4
- data/lib/split/experiment.rb +29 -18
- data/lib/split/goals_collection.rb +1 -0
- data/lib/split/helper.rb +4 -3
- data/lib/split/persistence/dual_adapter.rb +54 -12
- data/lib/split/redis_interface.rb +1 -0
- data/lib/split/trial.rb +4 -6
- data/lib/split/user.rb +5 -1
- data/lib/split/version.rb +1 -1
- data/lib/split.rb +8 -1
- data/spec/dashboard/pagination_helpers_spec.rb +3 -1
- data/spec/dashboard_helpers_spec.rb +2 -2
- data/spec/dashboard_spec.rb +37 -16
- data/spec/encapsulated_helper_spec.rb +1 -1
- data/spec/experiment_spec.rb +44 -5
- data/spec/helper_spec.rb +123 -80
- data/spec/persistence/dual_adapter_spec.rb +160 -68
- data/spec/trial_spec.rb +20 -0
- data/spec/user_spec.rb +11 -0
- data/split.gemspec +3 -3
- metadata +25 -8
data/.travis.yml
CHANGED
|
@@ -2,18 +2,19 @@ language: ruby
|
|
|
2
2
|
rvm:
|
|
3
3
|
- 1.9.3
|
|
4
4
|
- 2.0
|
|
5
|
-
- 2.1
|
|
6
|
-
- 2.2.0
|
|
5
|
+
- 2.1.10
|
|
7
6
|
- 2.2.2
|
|
8
|
-
- 2.
|
|
9
|
-
- 2.
|
|
7
|
+
- 2.3.8
|
|
8
|
+
- 2.4.9
|
|
9
|
+
- 2.5.7
|
|
10
|
+
- 2.6.5
|
|
10
11
|
|
|
11
12
|
gemfile:
|
|
12
13
|
- gemfiles/4.2.gemfile
|
|
13
14
|
- gemfiles/5.0.gemfile
|
|
14
15
|
- gemfiles/5.1.gemfile
|
|
15
16
|
- gemfiles/5.2.gemfile
|
|
16
|
-
|
|
17
|
+
- gemfiles/6.0.gemfile
|
|
17
18
|
|
|
18
19
|
matrix:
|
|
19
20
|
exclude:
|
|
@@ -21,30 +22,36 @@ matrix:
|
|
|
21
22
|
gemfile: gemfiles/5.0.gemfile
|
|
22
23
|
- rvm: 1.9.3
|
|
23
24
|
gemfile: gemfiles/5.1.gemfile
|
|
25
|
+
- rvm: 1.9.3
|
|
26
|
+
gemfile: gemfiles/5.2.gemfile
|
|
27
|
+
- rvm: 1.9.3
|
|
28
|
+
gemfile: gemfiles/6.0.gemfile
|
|
24
29
|
- rvm: 2.0
|
|
25
30
|
gemfile: gemfiles/5.0.gemfile
|
|
26
31
|
- rvm: 2.0
|
|
27
32
|
gemfile: gemfiles/5.1.gemfile
|
|
28
|
-
- rvm: 2.1
|
|
29
|
-
gemfile: gemfiles/5.0.gemfile
|
|
30
|
-
- rvm: 2.1
|
|
31
|
-
gemfile: gemfiles/5.1.gemfile
|
|
32
|
-
- rvm: 2.2.0
|
|
33
|
-
gemfile: gemfiles/5.0.gemfile
|
|
34
|
-
- rvm: 2.2.0
|
|
35
|
-
gemfile: gemfiles/5.1.gemfile
|
|
36
|
-
- rvm: 1.9.3
|
|
37
|
-
gemfile: gemfiles/5.2.gemfile
|
|
38
33
|
- rvm: 2.0
|
|
39
34
|
gemfile: gemfiles/5.2.gemfile
|
|
40
|
-
- rvm: 2.
|
|
41
|
-
gemfile: gemfiles/
|
|
42
|
-
- rvm: 2.
|
|
35
|
+
- rvm: 2.0
|
|
36
|
+
gemfile: gemfiles/6.0.gemfile
|
|
37
|
+
- rvm: 2.1.10
|
|
38
|
+
gemfile: gemfiles/5.0.gemfile
|
|
39
|
+
- rvm: 2.1.10
|
|
40
|
+
gemfile: gemfiles/5.1.gemfile
|
|
41
|
+
- rvm: 2.1.10
|
|
43
42
|
gemfile: gemfiles/5.2.gemfile
|
|
44
|
-
|
|
43
|
+
- rvm: 2.1.10
|
|
44
|
+
gemfile: gemfiles/6.0.gemfile
|
|
45
|
+
- rvm: 2.2.2
|
|
46
|
+
gemfile: gemfiles/6.0.gemfile
|
|
47
|
+
- rvm: 2.3.8
|
|
48
|
+
gemfile: gemfiles/6.0.gemfile
|
|
49
|
+
- rvm: 2.4.9
|
|
50
|
+
gemfile: gemfiles/6.0.gemfile
|
|
45
51
|
|
|
46
52
|
before_install:
|
|
47
|
-
- gem
|
|
53
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
|
54
|
+
- gem install bundler --version=1.17.3
|
|
48
55
|
|
|
49
56
|
script:
|
|
50
57
|
- RAILS_ENV=test bundle exec rake spec && bundle exec codeclimate-test-reporter
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
## 3.4.0 (November 9th, 2019)
|
|
2
|
+
|
|
3
|
+
Features:
|
|
4
|
+
- Improve DualAdapter (@santib, #588), adds a new configuration for the DualAdapter, making it possible to keep consistency for logged_out/logged_in users. It's a opt-in flag. No Behavior was changed on this release.
|
|
5
|
+
- Make dashboard pagination default "per" param configurable (@alopatin, #597)
|
|
6
|
+
|
|
7
|
+
Bugfixes:
|
|
8
|
+
- Fix `force_alternative` for experiments with incremented version (@giraffate, #568)
|
|
9
|
+
- Persist alternative weights (@giraffate, #570)
|
|
10
|
+
- Combined experiment performance improvements (@gnanou, #575)
|
|
11
|
+
- Handle correctly case when ab_finished is called before ab_test for a user (@gnanou, #577)
|
|
12
|
+
- When loading active_experiments, it should not look into user's 'finished' keys (@andrehjr, #582)
|
|
13
|
+
|
|
14
|
+
Misc:
|
|
15
|
+
- Remove `rubyforge_project` from gemspec (@giraffate, #583)
|
|
16
|
+
- Fix URLs to replace http with https (@giraffate , #584)
|
|
17
|
+
- Lazily include split helpers in ActionController::Base (@hasghari, #586)
|
|
18
|
+
- Fix unused variable warnings (@andrehjr, #592)
|
|
19
|
+
- Fix ruby warnings (@andrehjr, #593)
|
|
20
|
+
- Update rubocop.yml config (@andrehjr, #594)
|
|
21
|
+
- Add frozen_string_literal to all files that were missing it (@andrehjr, #595)
|
|
22
|
+
|
|
23
|
+
## 3.3.2 (April 12th, 2019)
|
|
24
|
+
|
|
25
|
+
Features:
|
|
26
|
+
- Added uptime robot to configuration.rb (@razel1982, #556)
|
|
27
|
+
- Check to see if being run in Rails application and run in before_initialize (@husteadrobert, #555)
|
|
28
|
+
|
|
29
|
+
Bugfixes:
|
|
30
|
+
- Fix error message interpolation (@hanibash, #553)
|
|
31
|
+
- Fix Bigdecimal warnings (@agraves, #551)
|
|
32
|
+
- Avoid hitting up on redis for robots/excluded users. (@andrehjr, #544)
|
|
33
|
+
- Checks for defined?(request) on Helper#exclude_visitor?. (@andrehjr)
|
|
34
|
+
|
|
35
|
+
Misc:
|
|
36
|
+
- Update travis to add Rails 6 (@edmilton, #559)
|
|
37
|
+
- Fix broken specs in developement environment (@dougpetronilio, #557)
|
|
38
|
+
|
|
39
|
+
## 3.3.1 (January 11th, 2019)
|
|
40
|
+
|
|
41
|
+
Features:
|
|
42
|
+
- Filter some more bots (@janosch-x, #542)
|
|
43
|
+
|
|
44
|
+
Bugfixes:
|
|
45
|
+
- Fix Dashboard Pagination Helper typo (@cattekin, #541)
|
|
46
|
+
- Do not storage alternative in cookie if experiment has a winner (@sadhu89, #539)
|
|
47
|
+
- fix user participating alternative not found (@NaturalHokke, #536)
|
|
48
|
+
|
|
49
|
+
Misc:
|
|
50
|
+
- Tweak RSpec instructions (@eliotsykes, #540)
|
|
51
|
+
- Improve README regarding rspec usage (@vermaxik, #538)
|
|
52
|
+
|
|
53
|
+
## 3.3.0 (August 13th, 2018)
|
|
54
|
+
|
|
55
|
+
Features:
|
|
56
|
+
|
|
57
|
+
- Added pagination for dashboard (@GeorgeGorbanev, #518)
|
|
58
|
+
- Add Facebot crawler to list of bots (@pfeiffer, #530)
|
|
59
|
+
- Ignore previewing requests (@pfeiffer, #531)
|
|
60
|
+
- Fix binding of ignore_filter (@pfeiffer, #533)
|
|
61
|
+
|
|
62
|
+
Bugfixes:
|
|
63
|
+
|
|
64
|
+
- Fix cookie header duplication (@andrehjr, #522)
|
|
65
|
+
|
|
66
|
+
Performance:
|
|
67
|
+
|
|
68
|
+
- Improve performance of RedisInterface#make_list_length by using LTRIM command (@mlovic, #509)
|
|
69
|
+
|
|
70
|
+
Misc:
|
|
71
|
+
|
|
72
|
+
- Update development dependencies
|
|
73
|
+
- test rails 5.2 on travis (@lostapathy, #524)
|
|
74
|
+
- update ruby versions for travis (@lostapathy, #525)
|
|
75
|
+
|
|
1
76
|
## 3.2.0 (September 21st, 2017)
|
|
2
77
|
|
|
3
78
|
Features:
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -68,7 +68,7 @@ members of the project's leadership.
|
|
|
68
68
|
## Attribution
|
|
69
69
|
|
|
70
70
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at [
|
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
|
72
72
|
|
|
73
|
-
[homepage]:
|
|
74
|
-
[version]:
|
|
73
|
+
[homepage]: https://contributor-covenant.org
|
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# [Split](
|
|
1
|
+
# [Split](https://libraries.io/rubygems/split)
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/split)
|
|
4
|
-
[](
|
|
4
|
+
[](https://travis-ci.org/splitrb/split)
|
|
5
5
|
[](https://codeclimate.com/github/splitrb/split)
|
|
6
6
|
[](https://codeclimate.com/github/splitrb/split/coverage)
|
|
7
7
|
[](https://github.com/RichardLitt/standard-readme)
|
|
8
8
|
[](https://www.codetriage.com/splitrb/split)
|
|
9
9
|
|
|
10
|
-
> 📈 The Rack Based A/B testing framework
|
|
10
|
+
> 📈 The Rack Based A/B testing framework https://libraries.io/rubygems/split
|
|
11
11
|
|
|
12
12
|
Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
|
|
13
13
|
|
|
@@ -110,9 +110,9 @@ Split has two options for you to use to determine which alternative is the best.
|
|
|
110
110
|
|
|
111
111
|
The first option (default on the dashboard) uses a z test (n>30) for the difference between your control and alternative conversion rates to calculate statistical significance. This test will tell you whether an alternative is better or worse than your control, but it will not distinguish between which alternative is the best in an experiment with multiple alternatives. Split will only tell you if your experiment is 90%, 95%, or 99% significant, and this test only works if you have more than 30 participants and 5 conversions for each branch.
|
|
112
112
|
|
|
113
|
-
As per this [blog post](
|
|
113
|
+
As per this [blog post](https://www.evanmiller.org/how-not-to-run-an-ab-test.html) on the pitfalls of A/B testing, it is highly recommended that you determine your requisite sample size for each branch before running the experiment. Otherwise, you'll have an increased rate of false positives (experiments which show a significant effect where really there is none).
|
|
114
114
|
|
|
115
|
-
[Here](
|
|
115
|
+
[Here](https://www.evanmiller.org/ab-testing/sample-size.html) is a sample size calculator for your convenience.
|
|
116
116
|
|
|
117
117
|
The second option uses simulations from a beta distribution to determine the probability that the given alternative is the winner compared to all other alternatives. You can view these probabilities by clicking on the drop-down menu labeled "Confidence." This option should be used when the experiment has more than just 1 control and 1 alternative. It can also be used for a simple, 2-alternative A/B test.
|
|
118
118
|
|
|
@@ -159,15 +159,15 @@ In the event you want to disable all tests without having to know the individual
|
|
|
159
159
|
|
|
160
160
|
It is not required to send `SPLIT_DISABLE=false` to activate Split.
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
|
|
163
|
+
### Rspec Helper
|
|
164
|
+
To aid testing with RSpec, write `spec/support/split_helper.rb` and call `use_ab_test(alternatives_by_experiment)` in your specs as instructed below:
|
|
163
165
|
|
|
164
166
|
```ruby
|
|
165
|
-
#
|
|
166
|
-
# is `require
|
|
167
|
+
# Create a file with these contents at 'spec/support/split_helper.rb'
|
|
168
|
+
# and ensure it is `require`d in your rails_helper.rb or spec_helper.rb
|
|
167
169
|
module SplitHelper
|
|
168
170
|
|
|
169
|
-
# Usage:
|
|
170
|
-
#
|
|
171
171
|
# Force a specific experiment alternative to always be returned:
|
|
172
172
|
# use_ab_test(signup_form: "single_page")
|
|
173
173
|
#
|
|
@@ -176,18 +176,26 @@ module SplitHelper
|
|
|
176
176
|
#
|
|
177
177
|
def use_ab_test(alternatives_by_experiment)
|
|
178
178
|
allow_any_instance_of(Split::Helper).to receive(:ab_test) do |_receiver, experiment|
|
|
179
|
-
|
|
180
|
-
alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
|
|
179
|
+
alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
|
|
181
180
|
end
|
|
182
181
|
end
|
|
183
182
|
end
|
|
184
183
|
|
|
184
|
+
# Make the `use_ab_test` method available to all specs:
|
|
185
185
|
RSpec.configure do |config|
|
|
186
|
-
# Make the `use_ab_test` method available to all specs:
|
|
187
186
|
config.include SplitHelper
|
|
188
187
|
end
|
|
189
188
|
```
|
|
190
189
|
|
|
190
|
+
Now you can call `use_ab_test(alternatives_by_experiment)` in your specs, for example:
|
|
191
|
+
```ruby
|
|
192
|
+
it "registers using experimental signup" do
|
|
193
|
+
use_ab_test experiment_name: "alternative_name"
|
|
194
|
+
post "/signups"
|
|
195
|
+
...
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
191
199
|
|
|
192
200
|
### Starting experiments manually
|
|
193
201
|
|
|
@@ -210,6 +218,12 @@ The user will then always see the alternative they started with.
|
|
|
210
218
|
|
|
211
219
|
Any old unfinished experiment key will be deleted from the user's data storage if the experiment had been removed or is over and a winner had been chosen. This allows a user to enroll into any new experiment in cases when the `allow_multiple_experiments` config option is set to `false`.
|
|
212
220
|
|
|
221
|
+
### Reset experiments manually
|
|
222
|
+
|
|
223
|
+
By default Split automatically resets the experiment whenever it detects the configuration for an experiment has changed (e.g. you call `ab_test` with different alternatives). You can prevent this by setting the option `reset_manually` to `true`.
|
|
224
|
+
|
|
225
|
+
You may want to do this when you want to change something, like the variants' names, the metadata about an experiment, etc. without resetting everything.
|
|
226
|
+
|
|
213
227
|
### Multiple experiments at once
|
|
214
228
|
|
|
215
229
|
By default Split will avoid users participating in multiple experiments at once. This means you are less likely to skew results by adding in more variation to your tests.
|
|
@@ -346,7 +360,7 @@ end
|
|
|
346
360
|
|
|
347
361
|
If you are running `ab_test` from a view, you must define your event
|
|
348
362
|
hook callback as a
|
|
349
|
-
[helper_method](
|
|
363
|
+
[helper_method](https://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper_method)
|
|
350
364
|
in the controller:
|
|
351
365
|
|
|
352
366
|
``` ruby
|
|
@@ -432,7 +446,7 @@ match "/split" => Split::Dashboard, anchor: false, via: [:get, :post, :delete],
|
|
|
432
446
|
end
|
|
433
447
|
```
|
|
434
448
|
|
|
435
|
-
More information on this [here](
|
|
449
|
+
More information on this [here](https://steve.dynedge.co.uk/2011/12/09/controlling-access-to-routes-and-rack-apps-in-rails-3-with-devise-and-warden/)
|
|
436
450
|
|
|
437
451
|
### Screenshot
|
|
438
452
|
|
|
@@ -450,6 +464,7 @@ Split.configure do |config|
|
|
|
450
464
|
config.enabled = true
|
|
451
465
|
config.persistence = Split::Persistence::SessionAdapter
|
|
452
466
|
#config.start_manually = false ## new test will have to be started manually from the admin panel. default false
|
|
467
|
+
#config.reset_manually = false ## if true, it never resets the experiment data, even if the configuration changes
|
|
453
468
|
config.include_rails_helper = true
|
|
454
469
|
config.redis = "redis://custom.redis.url:6380"
|
|
455
470
|
end
|
|
@@ -541,7 +556,7 @@ and:
|
|
|
541
556
|
ab_finished(:my_first_experiment)
|
|
542
557
|
```
|
|
543
558
|
|
|
544
|
-
You can also add meta data for each experiment, very useful when you need more than an alternative name to change behaviour:
|
|
559
|
+
You can also add meta data for each experiment, which is very useful when you need more than an alternative name to change behaviour:
|
|
545
560
|
|
|
546
561
|
```ruby
|
|
547
562
|
Split.configure do |config|
|
|
@@ -586,6 +601,8 @@ or in views:
|
|
|
586
601
|
<% end %>
|
|
587
602
|
```
|
|
588
603
|
|
|
604
|
+
The keys used in meta data should be Strings
|
|
605
|
+
|
|
589
606
|
#### Metrics
|
|
590
607
|
|
|
591
608
|
You might wish to track generic metrics, such as conversions, and use
|
|
@@ -809,8 +826,8 @@ end
|
|
|
809
826
|
|
|
810
827
|
## Extensions
|
|
811
828
|
|
|
812
|
-
- [Split::Export](
|
|
813
|
-
- [Split::Analytics](
|
|
829
|
+
- [Split::Export](https://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
|
|
830
|
+
- [Split::Analytics](https://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
|
|
814
831
|
- [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
|
|
815
832
|
- [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
|
|
816
833
|
- [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
|
|
@@ -822,7 +839,7 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
|
|
|
822
839
|
|
|
823
840
|
## Blogposts
|
|
824
841
|
|
|
825
|
-
* [Recipe: A/B testing with KISSMetrics and the split gem](
|
|
842
|
+
* [Recipe: A/B testing with KISSMetrics and the split gem](https://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
|
|
826
843
|
* [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
|
|
827
844
|
|
|
828
845
|
## Backers
|
|
@@ -902,9 +919,9 @@ Please do! Over 70 different people have contributed to the project, you can see
|
|
|
902
919
|
|
|
903
920
|
### Development
|
|
904
921
|
|
|
905
|
-
The source code is hosted at [GitHub](
|
|
922
|
+
The source code is hosted at [GitHub](https://github.com/splitrb/split).
|
|
906
923
|
|
|
907
|
-
Report issues and feature requests on [GitHub Issues](
|
|
924
|
+
Report issues and feature requests on [GitHub Issues](https://github.com/splitrb/split/issues).
|
|
908
925
|
|
|
909
926
|
You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
|
|
910
927
|
|
|
@@ -935,4 +952,4 @@ Please note that this project is released with a [Contributor Code of Conduct](C
|
|
|
935
952
|
|
|
936
953
|
## Copyright
|
|
937
954
|
|
|
938
|
-
[MIT License](LICENSE) ©
|
|
955
|
+
[MIT License](LICENSE) © 2019 [Andrew Nesbitt](https://github.com/andrew).
|
data/Rakefile
CHANGED
data/lib/split/alternative.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Split
|
|
|
15
15
|
@name = name
|
|
16
16
|
@weight = 1
|
|
17
17
|
end
|
|
18
|
-
p_winner = 0.0
|
|
18
|
+
@p_winner = 0.0
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def to_s
|
|
@@ -75,7 +75,7 @@ module Split
|
|
|
75
75
|
return field
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def set_completed_count
|
|
78
|
+
def set_completed_count(count, goal = nil)
|
|
79
79
|
field = set_field(goal)
|
|
80
80
|
Split.redis.hset(key, field, count.to_i)
|
|
81
81
|
end
|
|
@@ -122,7 +122,7 @@ module Split
|
|
|
122
122
|
# can't calculate zscore for P(x) > 1
|
|
123
123
|
return 'N/A' if p_a > 1 || p_c > 1
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Split::Zscore.calculate(p_a, n_a, p_c, n_c)
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
def extra_info
|
|
@@ -3,7 +3,7 @@ module Split
|
|
|
3
3
|
module CombinedExperimentsHelper
|
|
4
4
|
def ab_combined_test(metric_descriptor, control = nil, *alternatives)
|
|
5
5
|
return nil unless experiment = find_combined_experiment(metric_descriptor)
|
|
6
|
-
raise(Split::InvalidExperimentsFormatError,
|
|
6
|
+
raise(Split::InvalidExperimentsFormatError, "Unable to find experiment #{metric_descriptor} in configuration") if experiment[:combined_experiments].nil?
|
|
7
7
|
|
|
8
8
|
alternative = nil
|
|
9
9
|
weighted_alternatives = nil
|
|
@@ -31,7 +31,7 @@ module Split
|
|
|
31
31
|
raise(Split::InvalidExperimentsFormatError, 'Invalid descriptor class (String or Symbol required)') unless metric_descriptor.class == String || metric_descriptor.class == Symbol
|
|
32
32
|
raise(Split::InvalidExperimentsFormatError, 'Enable configuration') unless Split.configuration.enabled
|
|
33
33
|
raise(Split::InvalidExperimentsFormatError, 'Enable `allow_multiple_experiments`') unless Split.configuration.allow_multiple_experiments
|
|
34
|
-
|
|
34
|
+
Split::configuration.experiments[metric_descriptor.to_sym]
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
data/lib/split/configuration.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Split
|
|
3
3
|
class Configuration
|
|
4
|
-
attr_accessor :bots
|
|
5
|
-
attr_accessor :robot_regex
|
|
6
4
|
attr_accessor :ignore_ip_addresses
|
|
7
5
|
attr_accessor :ignore_filter
|
|
8
6
|
attr_accessor :db_failover
|
|
@@ -27,9 +25,13 @@ module Split
|
|
|
27
25
|
attr_accessor :beta_probability_simulations
|
|
28
26
|
attr_accessor :winning_alternative_recalculation_interval
|
|
29
27
|
attr_accessor :redis
|
|
28
|
+
attr_accessor :dashboard_pagination_default_per_page
|
|
30
29
|
|
|
31
30
|
attr_reader :experiments
|
|
32
31
|
|
|
32
|
+
attr_writer :bots
|
|
33
|
+
attr_writer :robot_regex
|
|
34
|
+
|
|
33
35
|
def bots
|
|
34
36
|
@bots ||= {
|
|
35
37
|
# Indexers
|
|
@@ -61,12 +63,14 @@ module Split
|
|
|
61
63
|
'ColdFusion' => 'ColdFusion http library',
|
|
62
64
|
'EventMachine HttpClient' => 'Ruby http library',
|
|
63
65
|
'Go http package' => 'Go http library',
|
|
66
|
+
'Go-http-client' => 'Go http library',
|
|
64
67
|
'Java' => 'Generic Java http library',
|
|
65
68
|
'libwww-perl' => 'Perl client-server library loved by script kids',
|
|
66
69
|
'lwp-trivial' => 'Another Perl library loved by script kids',
|
|
67
70
|
'Python-urllib' => 'Python http library',
|
|
68
71
|
'PycURL' => 'Python http library',
|
|
69
72
|
'Test Certificate Info' => 'C http library?',
|
|
73
|
+
'Typhoeus' => 'Ruby http library',
|
|
70
74
|
'Wget' => 'wget unix CLI http client',
|
|
71
75
|
|
|
72
76
|
# URL expanders / previewers
|
|
@@ -91,10 +95,12 @@ module Split
|
|
|
91
95
|
|
|
92
96
|
# Uptime monitoring
|
|
93
97
|
'check_http' => 'Nagios monitor',
|
|
98
|
+
'GoogleStackdriverMonitoring' => 'Google Cloud monitor',
|
|
94
99
|
'NewRelicPinger' => 'NewRelic monitor',
|
|
95
100
|
'Panopta' => 'Monitoring service',
|
|
96
101
|
'Pingdom' => 'Pingdom monitoring',
|
|
97
102
|
'SiteUptime' => 'Site monitoring services',
|
|
103
|
+
'UptimeRobot' => 'Monitoring service',
|
|
98
104
|
|
|
99
105
|
# ???
|
|
100
106
|
'DigitalPersona Fingerprint Software' => 'HP Fingerprint scanner',
|
|
@@ -221,6 +227,7 @@ module Split
|
|
|
221
227
|
@beta_probability_simulations = 10000
|
|
222
228
|
@winning_alternative_recalculation_interval = 60 * 60 * 24 # 1 day
|
|
223
229
|
@redis = ENV.fetch(ENV.fetch('REDIS_PROVIDER', 'REDIS_URL'), 'redis://localhost:6379')
|
|
230
|
+
@dashboard_pagination_default_per_page = 10
|
|
224
231
|
end
|
|
225
232
|
|
|
226
233
|
def redis_url=(value)
|
|
@@ -3,10 +3,9 @@ require 'split/dashboard/paginator'
|
|
|
3
3
|
|
|
4
4
|
module Split
|
|
5
5
|
module DashboardPaginationHelpers
|
|
6
|
-
DEFAULT_PER = 10
|
|
7
|
-
|
|
8
6
|
def pagination_per
|
|
9
|
-
|
|
7
|
+
default_per_page = Split.configuration.dashboard_pagination_default_per_page
|
|
8
|
+
@pagination_per ||= (params[:per] || default_per_page).to_i
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def page_number
|
|
@@ -25,7 +24,7 @@ module Split
|
|
|
25
24
|
html << current_page_tag
|
|
26
25
|
html << next_page_tag if show_next_page_tag?(collection)
|
|
27
26
|
html << ellipsis_tag if show_last_ellipsis_tag?(collection)
|
|
28
|
-
html <<
|
|
27
|
+
html << last_page_tag(collection) if show_last_page_tag?(collection)
|
|
29
28
|
html.join
|
|
30
29
|
end
|
|
31
30
|
|
data/lib/split/dashboard.rb
CHANGED
|
@@ -33,7 +33,10 @@ module Split
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
post '/force_alternative' do
|
|
36
|
-
Split::
|
|
36
|
+
experiment = Split::ExperimentCatalog.find(params[:experiment])
|
|
37
|
+
alternative = Split::Alternative.new(params[:alternative], experiment.name)
|
|
38
|
+
alternative.increment_participation
|
|
39
|
+
Split::User.new(self)[experiment.key] = alternative.name
|
|
37
40
|
redirect url('/')
|
|
38
41
|
end
|
|
39
42
|
|
data/lib/split/engine.rb
CHANGED
|
@@ -3,10 +3,12 @@ module Split
|
|
|
3
3
|
class Engine < ::Rails::Engine
|
|
4
4
|
initializer "split" do |app|
|
|
5
5
|
if Split.configuration.include_rails_helper
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
ActiveSupport.on_load(:action_controller) do
|
|
7
|
+
include Split::Helper
|
|
8
|
+
helper Split::Helper
|
|
9
|
+
include Split::CombinedExperimentsHelper
|
|
10
|
+
helper Split::CombinedExperimentsHelper
|
|
11
|
+
end
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
end
|