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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b45369489c7a861f224af9981f7636825c08164e
4
- data.tar.gz: 5b494f25bbf014a457fe17e84525db6f4269b3a0
3
+ metadata.gz: a3b1309c8ead9c52a0d0d6fe52c9b7e14caf82ea
4
+ data.tar.gz: 79d96d59eb43b6ce77fd9822f4f324cf4cf8b1e7
5
5
  SHA512:
6
- metadata.gz: d320a8d67b4bedb538a63a5268b35bc7b358a7e68ab8fbdf4a0970704d32f452c982192f70e74c9d34190088894063633cd3ca2ced6ccfc20e6696dad225ed63
7
- data.tar.gz: 33e8beb7302afe08d0b266eabf315ea27091119f82317772551f18c10af349f3925be9f63162a4a15907b0858f495fd04750ca2981e0592443dbe1ad9a36af2b
6
+ metadata.gz: c206f354515025bfbb3acae7641c99216078493f0d3de1d4bcabee6224ce6b44fd920af04ded93c807c7a07d8167fe6fd6e4c3fe008b83e521d5332f62023c65
7
+ data.tar.gz: e7613adebd501d9a4caa5d1c68f41cbec9b6b363a4da61a086865e356ebd360761e39ec47bb6b8de567d1499b8d47ea39ba0015b67a120ef2e5fefacc1fe16c0
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,7 @@
1
1
  ## Contributing
2
+
3
+ *Note*: Split requires Ruby 1.9.2 or higher.
4
+
2
5
  * Fork the project.
3
6
  * Make your feature addition or bug fix.
4
7
  * Add tests for it. This is important so I don't break it in a
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
@@ -15,7 +15,7 @@
15
15
  require "split/#{f}"
16
16
  end
17
17
 
18
- require 'split/engine' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
18
+ require 'split/engine' if defined?(Rails)
19
19
  require 'redis/namespace'
20
20
 
21
21
  module Split
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
@@ -1,6 +1,6 @@
1
1
  module Split
2
- MAJOR = 0
3
- MINOR = 8
2
+ MAJOR = 1
3
+ MINOR = 0
4
4
  PATCH = 0
5
5
  VERSION = [MAJOR, MINOR, PATCH].join('.')
6
6
  end
@@ -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(10+rand(30), goal2)
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.8.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-09-25 00:00:00.000000000 Z
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: '0'
226
+ version: 1.9.2
228
227
  required_rubygems_version: !ruby/object:Gem::Requirement
229
228
  requirements:
230
229
  - - ">="