Skip to content

Commit

Permalink
CI: Change and test earliest supported Ruby version (1.9.2 -> 2.2.0) (#…
Browse files Browse the repository at this point in the history
…498)

* gemspec: Change required Ruby version from 1.9.2 to 2.2.0

There are some incompatibilities between Split's dependencies and
earlier versions of Ruby (see
#494 (comment)).
2.2.0 is a relatively old version of Ruby that can run Split with
minimal code changes.

* Fix Ruby syntax incompatibility with version < 2.3

`Hash#dig` and `&.` are available only in 2.3+, but Split is supposed to
be compatible with Ruby 2.2.2+.

* CI: Add Rails 5.1 Gemfile to build matrix
  • Loading branch information
patbl authored and andrew committed Aug 30, 2017
1 parent 07b71ce commit d2a4a6c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
language: ruby
rvm:
- 2.2.0
- 2.2.2
- 2.4.1

gemfile:
- gemfiles/4.2.gemfile
- gemfiles/5.0.gemfile
- gemfiles/5.1.gemfile

matrix:
exclude:
- rvm: 2.2.0
gemfile: gemfiles/5.0.gemfile
- rvm: 2.2.0
gemfile: gemfiles/5.1.gemfile

before_install:
- gem install bundler
Expand Down
2 changes: 1 addition & 1 deletion lib/split/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def ab_test(metric_descriptor, control = nil, *alternatives)
experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
alternative = if Split.configuration.enabled
experiment.save
raise(Split::InvalidExperimentsFormatError) unless Split::configuration.experiments&.dig(experiment.name.to_sym,:combined_experiments).nil?
raise(Split::InvalidExperimentsFormatError) unless (Split.configuration.experiments || {}).fetch(experiment.name.to_sym, {})[:combined_experiments].nil?
trial = Trial.new(:user => ab_user, :experiment => experiment,
:override => override_alternative(experiment.name), :exclude => exclude_visitor?,
:disabled => split_generically_disabled?)
Expand Down
2 changes: 1 addition & 1 deletion split.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
"mailing_list_uri" => "https://groups.google.com/d/forum/split-ruby"
}

s.required_ruby_version = '>= 1.9.2'
s.required_ruby_version = '>= 2.2.0'

s.rubyforge_project = "split"

Expand Down

0 comments on commit d2a4a6c

Please sign in to comment.