Skip to content

Commit

Permalink
Merge pull request #271 from qpowell/remove-old-version-support
Browse files Browse the repository at this point in the history
Remove support for Ruby 1.8.7 and Rails 2.3
  • Loading branch information
andrew committed Oct 12, 2014
2 parents 55068c4 + 8277715 commit 2aa530c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Contributing

*Note*: Split requires Ruby 1.9.2 or higher.

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
Expand Down
23 changes: 2 additions & 21 deletions README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Split is designed to be hacker friendly, allowing for maximum customisation and

## Requirements

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.

Split uses redis as a datastore.

Split only supports redis 2.0 or greater.
Expand Down Expand Up @@ -53,29 +55,10 @@ and require it in your project:
require 'split'
```

### SystemTimer

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.

Put the following in your gemfile as well:

```
gem 'SystemTimer'
```

### Rails 3

Split is autoloaded when rails starts up, as long as you've configured redis it will 'just work'.

### Rails 2.3

To configure Rails 2.3 with Split you need to mix in the helper methods. Add the following lines to config/initializers.split.rb:

```ruby
ActionController::Base.send :include, Split::Helper
ActionController::Base.helper Split::Helper
```

### Sinatra

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:
Expand Down Expand Up @@ -163,8 +146,6 @@ ab_test('homepage design', 'Old', {'New' => 0.1})
ab_test('homepage design', {'Old' => 10}, 'New')
```

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.

This will only show the new alternative to visitors 1 in 10 times, the default weight for an alternative is 1.

### Overriding alternatives
Expand Down
2 changes: 1 addition & 1 deletion lib/split.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require "split/#{f}"
end

require 'split/engine' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
require 'split/engine' if defined?(Rails)
require 'redis/namespace'

module Split
Expand Down
3 changes: 0 additions & 3 deletions lib/split/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ module Split
module Helper

def ab_test(metric_descriptor, control=nil, *alternatives)
if RUBY_VERSION.match(/1\.8/) && alternatives.length.zero? && ! control.nil?
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'
end

# Check if array is passed to ab_test
# e.g. ab_test('name', ['Alt 1', 'Alt 2', 'Alt 3'])
Expand Down
7 changes: 2 additions & 5 deletions split.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Gem::Specification.new do |s|
s.homepage = "https://github.com/andrew/split"
s.summary = %q{Rack based split testing framework}

s.required_ruby_version = '>= 1.9.2'

s.rubyforge_project = "split"

s.files = `git ls-files`.split("\n")
Expand All @@ -23,11 +25,6 @@ Gem::Specification.new do |s|
s.add_dependency 'sinatra', '>= 1.2.6'
s.add_dependency 'simple-random'

# Ruby 1.8 doesn't include JSON in the std lib
if RUBY_VERSION < "1.9"
s.add_dependency 'json', '>= 1.7.7'
end

s.add_development_dependency 'rake'
s.add_development_dependency 'bundler', '~> 1.6'
s.add_development_dependency 'rspec', '~> 3.0'
Expand Down

0 comments on commit 2aa530c

Please sign in to comment.