split 2.2.0 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f98c552d0a03374e9cc58348c9c5df48b576f09
4
- data.tar.gz: 0c7073b3f025cb735a19e3e33da3784e44dc7c9e
3
+ metadata.gz: 76d9f44d0d50f07ea46e299f93bbb5bdb1333b8b
4
+ data.tar.gz: 40e88a5a32652b2acbd049562810fb8c8da03da4
5
5
  SHA512:
6
- metadata.gz: a1a5e85d6e9461106bd991def743d9d3482aa196e6b6df029a9179fdc65a4e4c1d5fafd03efdf7b748911d3a86bb7f510e9d934c508650519bfa8b0a8d570ed8
7
- data.tar.gz: 9f7ebba804fca8ba59250cfa81d0cac2c83ec97e652e2f5f456d0a4662043cbc6a3742fa9634ac06ec3316a3eb0e39e0e7b76eeef66331b65aa3c2d8716b8562
6
+ metadata.gz: c77ff217b8bdf985904c5949b7d401b479e516d6035f1e94ed50aebab5637bf3df9b9d4d22f9aa815a2c8f3a6d54c4cca66a71d4b43aa47c981ffda530a07d8f
7
+ data.tar.gz: 3bcacf988dbe704ca2460e681a1f0531fa1ca47486c4239d6e6db38234226b23186d55787e7bafefc8cfa9aeff12ce0400bbc6b1a83ed6166e89c9fca491711c
data/.travis.yml CHANGED
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.1
3
+ - 2.4.1
4
4
 
5
5
  gemfile:
6
- - gemfiles/4.1.gemfile
7
6
  - gemfiles/4.2.gemfile
8
7
  - gemfiles/5.0.gemfile
9
8
 
data/Appraisals CHANGED
@@ -1,12 +1,13 @@
1
- appraise "4.1" do
2
- gem "rails", "~> 4.1"
3
- end
4
-
5
1
  appraise "4.2" do
6
2
  gem "rails", "~> 4.2"
7
3
  end
8
4
 
9
5
  appraise "5.0" do
10
6
  gem "rails", "~> 5.0"
11
- gem "sinatra", github: "sinatra/sinatra"
7
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
8
+ end
9
+
10
+ appraise "5.1" do
11
+ gem "rails", "~> 5.1"
12
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
12
13
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
+ ## 3.1.0 (August 14th, 2017)
2
+
3
+ Features:
4
+
5
+ - Support for combined experiments (@daviddening, #493)
6
+ - Rewrite CookieAdapter to work with Rack::Request and Rack::Response directly (@andrehjr, #490)
7
+ - Enumeration of a User's Experiments that Respects the db_failover Option(@MarkRoddy, #487)
8
+
9
+ Bugfixes:
10
+
11
+ - Blocked a few more common bot user agents (@kylerippey, #485)
12
+
13
+ Misc:
14
+
15
+ - Repository Audit by Maintainer.io (@RichardLitt, #484)
16
+ - Update development dependencies
17
+ - Test on ruby 2.4.1
18
+ - Test compatibility with rails 5.1
19
+ - Add uris to metadata section in gemspec
20
+
21
+ ## 3.0.0 (March 30th, 2017)
22
+
23
+ Features:
24
+
25
+ - added block randomization algorithm and specs (@hulleywood, #475)
26
+ - Add ab_record_extra_info to allow record extra info to alternative and display on dashboard. (@tranngocsam, #460)
27
+
28
+ Bugfixes:
29
+
30
+ - Avoid crashing on Ruby 2.4 for numeric strings (@flori, #470)
31
+ - Fix issue where redis isn't required (@tomciopp , #466)
32
+
33
+ Misc:
34
+
35
+ - Avoid variable_size_secure_compare private method (@eliotsykes, #465)
36
+
1
37
  ## 2.2.0 (November 11th, 2016)
2
38
 
39
+ **Backwards incompatible!** Redis keys are renamed. Please make sure all running tests are completed before you upgrade, as they will reset.
40
+
3
41
  Features:
4
42
 
5
43
  - Remove dependency on Redis::Namespace (@bschaeffer, #425)
data/CONTRIBUTING.md CHANGED
@@ -1,13 +1,62 @@
1
- ## Contributing
1
+ # Contributing to Split
2
2
 
3
- *Note*: Split requires Ruby 1.9.2 or higher.
3
+ Want to contribute to Split? That's great! Here are a couple of guidelines that will help you contribute. Before we get started: Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md) to ensure that this project is a welcoming place for **everyone** to contribute to. By participating in this project you agree to abide by its terms.
4
+
5
+ #### Overview
6
+
7
+ * [Contribution workflow](#contribution-workflow)
8
+ * [Setup instructions](#setup-instructions)
9
+ * [Reporting a bug](#reporting-a-bug)
10
+ * [Contributing to an existing issue](#contributing-to-an-existing-issue)
11
+ * [Our labels](#our-labels)
12
+ * [Additional info](#additional-info)
13
+
14
+ ## Contribution workflow
4
15
 
5
16
  * Fork the project.
6
17
  * Make your feature addition or bug fix.
7
18
  * Add tests for it. This is important so I don't break it in a
8
19
  future version unintentionally.
9
20
  * Add documentation if necessary.
10
- * Commit, do not mess with rakefile, version, or history.
11
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
21
+ * Commit. Do not mess with the Rakefile, version, or history.
22
+ (If you want to have your own version, that is fine. But bump version in a commit by itself I can ignore when I pull.)
12
23
  * Send a pull request. Bonus points for topic branches.
13
- * Discussion at the [Google Group](https://groups.google.com/d/forum/split-ruby)
24
+ * Discussion at the [Google Group](https://groups.google.com/d/forum/split-ruby)
25
+
26
+ ## Setup instructions
27
+
28
+ You can find in-depth instructions to install in our [README](https://github.com/splitrb/split/blob/master/README.md).
29
+
30
+ *Note*: Split requires Ruby 1.9.2 or higher.
31
+
32
+ ## Reporting a bug
33
+
34
+ So you've found a bug, and want to help us fix it? Before filing a bug report, please double-check the bug hasn't already been reported. You can do so [on our issue tracker](https://github.com/splitrb/split/issues?q=is%3Aissue+is%3Aopen+label%3Abug). If something hasn't been raised, you can go ahead and create a new issue with the following information:
35
+
36
+ * When did the error happen?
37
+ * How can the error be reproduced?
38
+ * If possible, please also provide an error message or a screenshot to illustrate the problem.
39
+
40
+ If you want to be really thorough, there is a great overview on Stack Overflow of [what you should consider when reporting a bug](http://stackoverflow.com/questions/240323/how-to-report-bugs-the-smart-way).
41
+
42
+ It goes without saying that you're welcome to help investigate further and/or find a fix for the bug. If you want to do so, just mention it in your bug report and offer your help!
43
+
44
+ ## Contributing to an existing issue
45
+
46
+ ### Finding an issue to work on
47
+
48
+ We've got a few open issues and are always glad to get help on that front. You can view the list of issues [here](https://github.com/splitrb/split/issues). Most of the issues are labelled, so you can use the labels to get an idea of which issue could be a good fit for you. (Here's [a good article](https://medium.freecodecamp.com/finding-your-first-open-source-project-or-bug-to-work-on-1712f651e5ba) on how to find your first bug to fix).
49
+
50
+ Before getting to work, take a look at the issue and at the conversation around it. Has someone already offered to work on the issue? Has someone been assigned to the issue? If so, you might want to check with them to see whether they're still actively working on it.
51
+
52
+ If the issue is a few months old, it might be a good idea to write a short comment to double-check that the issue or feature is still a valid one to jump on.
53
+
54
+ Feel free to ask for more detail on what is expected: are there any more details or specifications you need to know?
55
+
56
+ And if at any point you get stuck: don't hesitate to ask for help.
57
+
58
+ ### Making your contribution
59
+
60
+ We've outlined the contribution workflow [here](#contribution-workflow). If you're a first-timer, don't worry! GitHub has a ton of guides to help you through your first pull request: You can find out more about pull requests [here](https://help.github.com/articles/about-pull-requests/) and about creating a pull request [here](https://help.github.com/articles/creating-a-pull-request/).
61
+
62
+ Especially if you're a newcomer to Open Source and you've found some little bumps along the way while contributing, we recommend you write about them. [Here](https://medium.freecodecamp.com/new-contributors-to-open-source-please-blog-more-920af14cffd)'s a great article about why writing about your experience is important; this will encourage other beginners to try their luck at Open Source, too!
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Andrew Nesbitt
3
+ Copyright (c) 2017 Andrew Nesbitt
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,97 +1,28 @@
1
- # [Split](http://libraries.io/rubygems/split)
2
-
3
- Split is a rack based ab testing framework designed to work with Rails, Sinatra or any other rack based app.
4
-
5
- Split is heavily inspired by the Abingo and Vanity rails ab testing plugins and Resque in its use of Redis.
6
-
7
- Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
1
+ # [Split](http://libraries.io/rubygems/split)
8
2
 
9
3
  [![Gem Version](https://badge.fury.io/rb/split.svg)](http://badge.fury.io/rb/split)
10
4
  [![Build Status](https://secure.travis-ci.org/splitrb/split.svg?branch=master)](http://travis-ci.org/splitrb/split)
11
5
  [![Code Climate](https://codeclimate.com/github/splitrb/split/badges/gpa.svg)](https://codeclimate.com/github/splitrb/split)
12
6
  [![Test Coverage](https://codeclimate.com/github/splitrb/split/badges/coverage.svg)](https://codeclimate.com/github/splitrb/split/coverage)
7
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
13
8
 
9
+ > 📈 The Rack Based A/B testing framework http://libraries.io/rubygems/split
14
10
 
15
- # Backers
16
-
17
- Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
18
-
19
- <a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
20
- <a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
21
- <a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
22
- <a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
23
- <a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
24
- <a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
25
- <a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
26
- <a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
27
- <a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
28
- <a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
29
- <a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
30
- <a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
31
- <a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
32
- <a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
33
- <a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
34
- <a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
35
- <a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
36
- <a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
37
- <a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
38
- <a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
39
- <a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
40
- <a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
41
- <a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
42
- <a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
43
- <a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
44
- <a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
45
- <a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
46
- <a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
47
- <a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
48
- <a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
49
-
50
-
51
- # Sponsors
11
+ Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
52
12
 
53
- Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
54
-
55
- <a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
56
- <a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
57
- <a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
58
- <a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
59
- <a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
60
- <a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
61
- <a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
62
- <a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
63
- <a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
64
- <a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
65
- <a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
66
- <a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
67
- <a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
68
- <a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
69
- <a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
70
- <a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
71
- <a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
72
- <a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
73
- <a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
74
- <a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
75
- <a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
76
- <a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
77
- <a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
78
- <a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
79
- <a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
80
- <a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
81
- <a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
82
- <a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
83
- <a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
84
- <a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
13
+ Split is heavily inspired by the [Abingo](https://github.com/ryanb/abingo) and [Vanity](https://github.com/assaf/vanity) Rails A/B testing plugins and [Resque](https://github.com/resque/resque) in its use of Redis.
85
14
 
15
+ Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
86
16
 
17
+ ## Install
87
18
 
88
- ## Requirements
19
+ ### Requirements
89
20
 
90
21
  Split currently requires Ruby 1.9.2 or higher. If your project requires compatibility with Ruby 1.8.x and Rails 2.3, please use v0.8.0.
91
22
 
92
- Split uses redis as a datastore.
23
+ Split uses Redis as a datastore.
93
24
 
94
- Split only supports redis 2.0 or greater.
25
+ Split only supports Redis 2.0 or greater.
95
26
 
96
27
  If you're on OS X, Homebrew is the simplest way to install Redis:
97
28
 
@@ -100,21 +31,21 @@ brew install redis
100
31
  redis-server /usr/local/etc/redis.conf
101
32
  ```
102
33
 
103
- You now have a Redis daemon running on 6379.
34
+ You now have a Redis daemon running on port `6379`.
104
35
 
105
- ## Setup
36
+ ### Setup
106
37
 
107
38
  ```bash
108
39
  gem install split
109
40
  ```
110
41
 
111
- ### Rails
42
+ #### Rails
112
43
 
113
- Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured redis it will 'just work'.
44
+ Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured Redis it will 'just work'.
114
45
 
115
- ### Sinatra
46
+ #### Sinatra
116
47
 
117
- To configure sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your sinatra app:
48
+ To configure Sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your Sinatra app:
118
49
 
119
50
  ```ruby
120
51
  require 'split'
@@ -130,7 +61,7 @@ end
130
61
 
131
62
  ## Usage
132
63
 
133
- To begin your ab test use the `ab_test` method, naming your experiment with the first argument and then the different alternatives which you wish to test on as the other arguments.
64
+ To begin your A/B test use the `ab_test` method, naming your experiment with the first argument and then the different alternatives which you wish to test on as the other arguments.
134
65
 
135
66
  `ab_test` returns one of the alternatives, if a user has already seen that test they will get the same alternative as before, which you can use to split your code on.
136
67
 
@@ -184,7 +115,6 @@ As per this [blog post](http://www.evanmiller.org/how-not-to-run-an-ab-test.html
184
115
 
185
116
  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.
186
117
 
187
-
188
118
  ## Extras
189
119
 
190
120
  ### Weighted alternatives
@@ -222,7 +152,7 @@ It is not required to send `SPLIT_DISABLE=false` to activate Split.
222
152
 
223
153
  ### Starting experiments manually
224
154
 
225
- By default new AB tests will be active right after deployment. In case you would like to start new test a while after
155
+ By default new A/B tests will be active right after deployment. In case you would like to start new test a while after
226
156
  the deploy, you can do it by setting the `start_manually` configuration option to `true`.
227
157
 
228
158
  After choosing this option tests won't be started right after deploy, but after pressing the `Start` button in Split admin dashboard. If a test is deleted from the Split dashboard, then it can only be started after pressing the `Start` button whenever being re-initialized.
@@ -439,9 +369,9 @@ You may want to password protect that page, you can do so with `Rack::Auth::Basi
439
369
  Split::Dashboard.use Rack::Auth::Basic do |username, password|
440
370
  # Protect against timing attacks:
441
371
  # - Use & (do not use &&) so that it doesn't short circuit.
442
- # - Use `variable_size_secure_compare` to stop length information leaking
443
- ActiveSupport::SecurityUtils.variable_size_secure_compare(username, ENV["SPLIT_USERNAME"]) &
444
- ActiveSupport::SecurityUtils.variable_size_secure_compare(password, ENV["SPLIT_PASSWORD"])
372
+ # - Use digests to stop length information leaking
373
+ ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV["SPLIT_USERNAME"])) &
374
+ ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV["SPLIT_PASSWORD"]))
445
375
  end
446
376
 
447
377
  # Apps without activesupport
@@ -475,7 +405,7 @@ You can override the default configuration options of Split like so:
475
405
 
476
406
  ```ruby
477
407
  Split.configure do |config|
478
- config.db_failover = true # handle redis errors gracefully
408
+ config.db_failover = true # handle Redis errors gracefully
479
409
  config.db_failover_on_db_error = -> (error) { Rails.logger.error(error.message) }
480
410
  config.allow_multiple_experiments = true
481
411
  config.enabled = true
@@ -693,6 +623,35 @@ Once you finish one of the goals, the test is considered to be completed, and fi
693
623
 
694
624
  **Bad Example**: Test both how button color affects signup *and* how it affects login, at the same time. THIS WILL NOT WORK.
695
625
 
626
+ #### Combined Experiments
627
+ If you want to test how how button color affects signup *and* how it affects login, at the same time. Use combined tests
628
+ Configure like so
629
+ ```ruby
630
+ Split.configuration.experiments = {
631
+ :button_color_experiment => {
632
+ :alternatives => ["blue", "green"],
633
+ :combined_experiments => ["button_color_on_signup", "button_color_on_login"]
634
+ }
635
+ }
636
+ ```
637
+
638
+ Starting the combined test starts all combined experiments
639
+ ```ruby
640
+ ab_combined_test(:button_color_experiment)
641
+ ```
642
+ Finish each combined test as normal
643
+
644
+ ```ruby
645
+ ab_finished(:button_color_on_login)
646
+ ab_finished(:button_color_on_signup)
647
+ ```
648
+
649
+ **Additional Configuration**:
650
+ * Be sure to enable `allow_multiple_experiments`
651
+ * In Sinatra include the CombinedExperimentsHelper
652
+ ```
653
+ helpers Split::CombinedExperimentsHelper
654
+ ```
696
655
  ### DB failover solution
697
656
 
698
657
  Due to the fact that Redis has no automatic failover mechanism, it's
@@ -793,6 +752,12 @@ It is possible to specify static weights to favor certain alternatives.
793
752
  This algorithm will automatically weight the alternatives based on their relative performance,
794
753
  choosing the better-performing ones more often as trials are completed.
795
754
 
755
+ `Split::Algorithms::BlockRandomization` is an algorithm that ensures equal
756
+ participation across all alternatives. This algorithm will choose the alternative
757
+ with the fewest participants. In the event of multiple minimum participant alternatives
758
+ (i.e. starting a new "Block") the algorithm will choose a random alternative from
759
+ those minimum participant alternatives.
760
+
796
761
  Users may also write their own algorithms. The default algorithm may be specified globally in the configuration file, or on a per experiment basis using the experiments hash of the configuration file.
797
762
 
798
763
  To change the algorithm globally for all experiments, use the following in your initializer:
@@ -805,12 +770,12 @@ end
805
770
 
806
771
  ## Extensions
807
772
 
808
- - [Split::Export](http://github.com/splitrb/split-export) - easily export ab test data out of Split
809
- - [Split::Analytics](http://github.com/splitrb/split-analytics) - push test data to google analytics
810
- - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - store experiment data in mongoid (still uses redis)
811
- - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - automatically create cache buckets per test
812
- - [Split::Counters](https://github.com/bernardkroes/split-counters) - add counters per experiment and alternative
813
- - [Split::Cli](https://github.com/craigmcnamara/split-cli) - a CLI to trigger Split A/B tests
773
+ - [Split::Export](http://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
774
+ - [Split::Analytics](http://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
775
+ - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
776
+ - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
777
+ - [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
778
+ - [Split::Cli](https://github.com/craigmcnamara/split-cli) - A CLI to trigger Split A/B tests.
814
779
 
815
780
  ## Screencast
816
781
 
@@ -818,15 +783,93 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
818
783
 
819
784
  ## Blogposts
820
785
 
821
- * [A/B Testing with Split in Ruby on Rails](http://grinnick.com/posts/a-b-testing-with-split-in-ruby-on-rails)
822
786
  * [Recipe: A/B testing with KISSMetrics and the split gem](http://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
823
787
  * [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
824
788
 
825
- ## Contributors
789
+ ## Backers
790
+
791
+ Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
792
+
793
+ <a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
794
+ <a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
795
+ <a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
796
+ <a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
797
+ <a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
798
+ <a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
799
+ <a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
800
+ <a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
801
+ <a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
802
+ <a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
803
+ <a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
804
+ <a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
805
+ <a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
806
+ <a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
807
+ <a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
808
+ <a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
809
+ <a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
810
+ <a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
811
+ <a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
812
+ <a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
813
+ <a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
814
+ <a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
815
+ <a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
816
+ <a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
817
+ <a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
818
+ <a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
819
+ <a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
820
+ <a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
821
+ <a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
822
+ <a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
823
+
824
+
825
+ ## Sponsors
826
+
827
+ Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
828
+
829
+ <a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
830
+ <a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
831
+ <a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
832
+ <a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
833
+ <a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
834
+ <a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
835
+ <a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
836
+ <a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
837
+ <a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
838
+ <a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
839
+ <a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
840
+ <a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
841
+ <a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
842
+ <a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
843
+ <a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
844
+ <a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
845
+ <a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
846
+ <a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
847
+ <a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
848
+ <a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
849
+ <a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
850
+ <a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
851
+ <a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
852
+ <a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
853
+ <a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
854
+ <a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
855
+ <a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
856
+ <a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
857
+ <a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
858
+ <a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
826
859
 
827
- Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors
860
+ ## Contribute
828
861
 
829
- ## Development
862
+ Please do! Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors.
863
+
864
+ ### Development
865
+
866
+ The source code is hosted at [GitHub](http://github.com/splitrb/split).
867
+
868
+ Report issues and feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
869
+
870
+ You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
871
+
872
+ ### Tests
830
873
 
831
874
  Run the tests like this:
832
875
 
@@ -836,23 +879,21 @@ Run the tests like this:
836
879
  bundle
837
880
  rake spec
838
881
 
839
- Source hosted at [GitHub](http://github.com/splitrb/split).
840
-
841
- Report Issues/Feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
842
-
843
- Discussion at [Google Groups](https://groups.google.com/d/forum/split-ruby).
844
-
845
- ### Note on Patches/Pull Requests
882
+ ### A Note on Patches and Pull Requests
846
883
 
847
884
  * Fork the project.
848
885
  * Make your feature addition or bug fix.
849
886
  * Add tests for it. This is important so I don't break it in a
850
887
  future version unintentionally.
851
888
  * Add documentation if necessary.
852
- * Commit, do not mess with rakefile, version, or history.
853
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
889
+ * Commit. Do not mess with the rakefile, version, or history.
890
+ (If you want to have your own version, that is fine. But bump the version in a commit by itself, which I can ignore when I pull.)
854
891
  * Send a pull request. Bonus points for topic branches.
855
892
 
893
+ ### Code of Conduct
894
+
895
+ Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
896
+
856
897
  ## Copyright
857
898
 
858
- Copyright (c) 2016 Andrew Nesbitt. See [LICENSE](https://github.com/splitrb/split/blob/master/LICENSE) for details.
899
+ [MIT License](LICENSE) © 2017 [Andrew Nesbitt](https://github.com/andrew).
data/gemfiles/4.2.gemfile CHANGED
@@ -6,4 +6,4 @@ gem "appraisal"
6
6
  gem "codeclimate-test-reporter"
7
7
  gem "rails", "~> 4.2"
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: "../"
data/gemfiles/5.0.gemfile CHANGED
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "appraisal"
6
6
  gem "codeclimate-test-reporter"
7
7
  gem "rails", "~> 5.0"
8
- gem "sinatra", :github => "sinatra/sinatra"
8
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
9
9
 
10
- gemspec :path => "../"
10
+ gemspec path: "../"
@@ -4,6 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
6
  gem "codeclimate-test-reporter"
7
- gem "rails", "~> 4.1"
7
+ gem "rails", "~> 5.1"
8
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
8
9
 
9
- gemspec :path => "../"
10
+ gemspec path: "../"
@@ -0,0 +1,22 @@
1
+ # Selects alternative with minimum count of participants
2
+ # If all counts are even (i.e. all are minimum), samples from all possible alternatives
3
+
4
+ module Split
5
+ module Algorithms
6
+ module BlockRandomization
7
+ class << self
8
+ def choose_alternative(experiment)
9
+ minimum_participant_alternatives(experiment.alternatives).sample
10
+ end
11
+
12
+ private
13
+
14
+ def minimum_participant_alternatives(alternatives)
15
+ alternatives_by_count = alternatives.group_by(&:participant_count)
16
+ min_group = alternatives_by_count.min_by { |k, v| k }
17
+ min_group.last
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end