split 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -0
- data/README.mdown +3 -22
- data/lib/split.rb +1 -1
- data/lib/split/helper.rb +0 -3
- data/lib/split/version.rb +2 -2
- data/spec/experiment_spec.rb +1 -1
- data/split.gemspec +2 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3b1309c8ead9c52a0d0d6fe52c9b7e14caf82ea
|
4
|
+
data.tar.gz: 79d96d59eb43b6ce77fd9822f4f324cf4cf8b1e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c206f354515025bfbb3acae7641c99216078493f0d3de1d4bcabee6224ce6b44fd920af04ded93c807c7a07d8167fe6fd6e4c3fe008b83e521d5332f62023c65
|
7
|
+
data.tar.gz: e7613adebd501d9a4caa5d1c68f41cbec9b6b363a4da61a086865e356ebd360761e39ec47bb6b8de567d1499b8d47ea39ba0015b67a120ef2e5fefacc1fe16c0
|
data/CONTRIBUTING.md
CHANGED
data/README.mdown
CHANGED
@@ -14,6 +14,8 @@ Split is designed to be hacker friendly, allowing for maximum customisation and
|
|
14
14
|
|
15
15
|
## Requirements
|
16
16
|
|
17
|
+
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.
|
18
|
+
|
17
19
|
Split uses redis as a datastore.
|
18
20
|
|
19
21
|
Split only supports redis 2.0 or greater.
|
@@ -53,29 +55,10 @@ and require it in your project:
|
|
53
55
|
require 'split'
|
54
56
|
```
|
55
57
|
|
56
|
-
### SystemTimer
|
57
|
-
|
58
|
-
If you are using Redis on Ruby 1.8.x then you will likely want to also use the SystemTimer gem if you want to make sure the Redis client will not hang.
|
59
|
-
|
60
|
-
Put the following in your gemfile as well:
|
61
|
-
|
62
|
-
```
|
63
|
-
gem 'SystemTimer'
|
64
|
-
```
|
65
|
-
|
66
58
|
### Rails 3
|
67
59
|
|
68
60
|
Split is autoloaded when rails starts up, as long as you've configured redis it will 'just work'.
|
69
61
|
|
70
|
-
### Rails 2.3
|
71
|
-
|
72
|
-
To configure Rails 2.3 with Split you need to mix in the helper methods. Add the following lines to config/initializers.split.rb:
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
ActionController::Base.send :include, Split::Helper
|
76
|
-
ActionController::Base.helper Split::Helper
|
77
|
-
```
|
78
|
-
|
79
62
|
### Sinatra
|
80
63
|
|
81
64
|
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:
|
@@ -163,8 +146,6 @@ ab_test('homepage design', 'Old', {'New' => 0.1})
|
|
163
146
|
ab_test('homepage design', {'Old' => 10}, 'New')
|
164
147
|
```
|
165
148
|
|
166
|
-
Note: If using ruby 1.8.x and weighted alternatives you should always pass the control alternative through as the second argument with any other alternatives as a third argument because the order of the hash is not preserved in ruby 1.8, ruby 1.9.1+ users are not affected by this bug.
|
167
|
-
|
168
149
|
This will only show the new alternative to visitors 1 in 10 times, the default weight for an alternative is 1.
|
169
150
|
|
170
151
|
### Overriding alternatives
|
@@ -354,7 +335,7 @@ end
|
|
354
335
|
|
355
336
|
You can even use Devise or any other Warden-based authentication method to authorize users. Just replace `mount Split::Dashboard, :at => 'split'` in `config/routes.rb` with the following:
|
356
337
|
```ruby
|
357
|
-
match "/split" => Split::Dashboard, :anchor => false, :constraints => lambda { |request|
|
338
|
+
match "/split" => Split::Dashboard, :anchor => false, :via => [:get, :post], :constraints => lambda { |request|
|
358
339
|
request.env['warden'].authenticated? # are we authenticated?
|
359
340
|
request.env['warden'].authenticate! # authenticate if not already
|
360
341
|
# or even check any other condition such as request.env['warden'].user.is_admin?
|
data/lib/split.rb
CHANGED
data/lib/split/helper.rb
CHANGED
@@ -2,9 +2,6 @@ module Split
|
|
2
2
|
module Helper
|
3
3
|
|
4
4
|
def ab_test(metric_descriptor, control=nil, *alternatives)
|
5
|
-
if RUBY_VERSION.match(/1\.8/) && alternatives.length.zero? && ! control.nil?
|
6
|
-
puts 'WARNING: You should always pass the control alternative through as the second argument with any other alternatives as the third because the order of the hash is not preserved in ruby 1.8'
|
7
|
-
end
|
8
5
|
|
9
6
|
# Check if array is passed to ab_test
|
10
7
|
# e.g. ab_test('name', ['Alt 1', 'Alt 2', 'Alt 3'])
|
data/lib/split/version.rb
CHANGED
data/spec/experiment_spec.rb
CHANGED
@@ -397,7 +397,7 @@ describe Split::Experiment do
|
|
397
397
|
experiment.alternatives.each do |alternative|
|
398
398
|
alternative.participant_count = 50
|
399
399
|
alternative.set_completed_count(10, goal1)
|
400
|
-
alternative.set_completed_count(
|
400
|
+
alternative.set_completed_count(15+rand(30), goal2)
|
401
401
|
end
|
402
402
|
experiment.calc_winning_alternatives
|
403
403
|
alt = experiment.alternatives[0]
|
data/split.gemspec
CHANGED
@@ -12,6 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = "https://github.com/andrew/split"
|
13
13
|
s.summary = %q{Rack based split testing framework}
|
14
14
|
|
15
|
+
s.required_ruby_version = '>= 1.9.2'
|
16
|
+
|
15
17
|
s.rubyforge_project = "split"
|
16
18
|
|
17
19
|
s.files = `git ls-files`.split("\n")
|
@@ -23,11 +25,6 @@ Gem::Specification.new do |s|
|
|
23
25
|
s.add_dependency 'sinatra', '>= 1.2.6'
|
24
26
|
s.add_dependency 'simple-random'
|
25
27
|
|
26
|
-
# Ruby 1.8 doesn't include JSON in the std lib
|
27
|
-
if RUBY_VERSION < "1.9"
|
28
|
-
s.add_dependency 'json', '>= 1.7.7'
|
29
|
-
end
|
30
|
-
|
31
28
|
s.add_development_dependency 'rake'
|
32
29
|
s.add_development_dependency 'bundler', '~> 1.6'
|
33
30
|
s.add_development_dependency 'rspec', '~> 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -143,7 +143,6 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- ".DS_Store"
|
147
146
|
- ".gitignore"
|
148
147
|
- ".travis.yml"
|
149
148
|
- Appraisals
|
@@ -224,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
223
|
requirements:
|
225
224
|
- - ">="
|
226
225
|
- !ruby/object:Gem::Version
|
227
|
-
version:
|
226
|
+
version: 1.9.2
|
228
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
228
|
requirements:
|
230
229
|
- - ">="
|