Skip to content

Commit f2c085d

Browse files
authored
[ch12303] Make pre ruby 2.1.0 faraday dependencies explicit and add jruby 9xx build (#40)
Also work around jruby-9.0.5.0 issue with return statements inside lambdas used as blocks.
1 parent 2c35255 commit f2c085d

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

circle.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
machine:
22
environment:
3-
RUBIES: "ruby-2.4.1;ruby-2.2.3;ruby-2.1.7;ruby-2.0.0;ruby-1.9.3;jruby-1.7.22"
3+
RUBIES: "ruby-2.4.2 ruby-2.2.7 ruby-2.1.9 ruby-2.0.0 ruby-1.9.3 jruby-1.7.22 jruby-9.0.5.0 jruby-9.1.13.0"
44
services:
55
- redis
66

77
dependencies:
88
cache_directories:
9-
- '../.rvm/rubies'
9+
- '/opt/circleci/.rvm/rubies'
1010

1111
override:
12-
- >
13-
rubiesArray=(${RUBIES//;/ });
14-
for i in "${rubiesArray[@]}";
12+
- |
13+
set -e
14+
for i in $RUBIES;
1515
do
1616
rvm install $i;
1717
rvm use $i;
18-
gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
18+
if [[ $i == jruby* ]]; then
19+
gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
20+
fi
1921
gem install bundler;
2022
bundle install;
2123
mv Gemfile.lock "Gemfile.lock.$i"
2224
done
2325
2426
test:
2527
override:
26-
- >
27-
rubiesArray=(${RUBIES//;/ });
28-
for i in "${rubiesArray[@]}";
28+
- |
29+
set -e
30+
for i in $RUBIES;
2931
do
3032
rvm use $i;
3133
cp "Gemfile.lock.$i" Gemfile.lock;

ldclient-rb.gemspec

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ Gem::Specification.new do |spec|
3030
spec.add_development_dependency "moneta", "~> 1.0.0"
3131

3232
spec.add_runtime_dependency "json", [">= 1.8", "< 3"]
33-
spec.add_runtime_dependency "faraday", [">= 0.9", "< 2"]
34-
spec.add_runtime_dependency "faraday-http-cache", [">= 1.3.0", "< 3"]
33+
if RUBY_VERSION >= "2.1.0"
34+
spec.add_runtime_dependency "faraday", [">= 0.9", "< 2"]
35+
spec.add_runtime_dependency "faraday-http-cache", [">= 1.3.0", "< 3"]
36+
else
37+
spec.add_runtime_dependency "faraday", [">= 0.9", "< 0.14.0"]
38+
spec.add_runtime_dependency "faraday-http-cache", [">= 1.3.0", "< 2"]
39+
end
3540
spec.add_runtime_dependency "semantic", "~> 1.6.0"
3641
spec.add_runtime_dependency "thread_safe", "~> 0.3"
3742
spec.add_runtime_dependency "net-http-persistent", "~> 2.9"

lib/ldclient-rb/evaluation.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ module Evaluation
2222
end
2323

2424
SEMVER_OPERAND = lambda do |v|
25+
semver = nil
2526
if v.is_a? String
2627
for _ in 0..2 do
2728
begin
28-
return Semantic::Version.new(v)
29+
semver = Semantic::Version.new(v)
30+
break # Some versions of jruby cannot properly handle a return here and return from the method that calls this lambda
2931
rescue ArgumentError
3032
v = addZeroVersionComponent(v)
3133
end
3234
end
3335
end
34-
nil
36+
semver
3537
end
3638

3739
def self.addZeroVersionComponent(v)

0 commit comments

Comments
 (0)