Skip to content

Commit d2a4a6c

Browse files
patblandrew
authored andcommitted
CI: Change and test earliest supported Ruby version (1.9.2 -> 2.2.0) (#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
1 parent 07b71ce commit d2a4a6c

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
language: ruby
22
rvm:
3+
- 2.2.0
4+
- 2.2.2
35
- 2.4.1
46

57
gemfile:
68
- gemfiles/4.2.gemfile
79
- gemfiles/5.0.gemfile
10+
- gemfiles/5.1.gemfile
11+
12+
matrix:
13+
exclude:
14+
- rvm: 2.2.0
15+
gemfile: gemfiles/5.0.gemfile
16+
- rvm: 2.2.0
17+
gemfile: gemfiles/5.1.gemfile
818

919
before_install:
1020
- gem install bundler

lib/split/helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def ab_test(metric_descriptor, control = nil, *alternatives)
1010
experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
1111
alternative = if Split.configuration.enabled
1212
experiment.save
13-
raise(Split::InvalidExperimentsFormatError) unless Split::configuration.experiments&.dig(experiment.name.to_sym,:combined_experiments).nil?
13+
raise(Split::InvalidExperimentsFormatError) unless (Split.configuration.experiments || {}).fetch(experiment.name.to_sym, {})[:combined_experiments].nil?
1414
trial = Trial.new(:user => ab_user, :experiment => experiment,
1515
:override => override_alternative(experiment.name), :exclude => exclude_visitor?,
1616
:disabled => split_generically_disabled?)

split.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
"mailing_list_uri" => "https://groups.google.com/d/forum/split-ruby"
2222
}
2323

24-
s.required_ruby_version = '>= 1.9.2'
24+
s.required_ruby_version = '>= 2.2.0'
2525

2626
s.rubyforge_project = "split"
2727

0 commit comments

Comments
 (0)