diff --git a/.travis.yml b/.travis.yml index 67acebd..dd3276a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,16 @@ sudo: false language: ruby bundler_args: --without development -env: JRUBY_OPTS='--server -Xcompile.invokedynamic=false' +env: + global: + - JRUBY_OPTS='--server -Xcompile.invokedynamic=false' + - _JAVA_OPTIONS= rvm: - 2.2.5 - 2.3.1 - jruby-9.1.2.0 + - jruby-9.1.8.0 before_install: gem install bundler -v 1.12.5 + cache: bundler diff --git a/lib/ruby_dep/ruby_version.rb b/lib/ruby_dep/ruby_version.rb index da9acbc..ccaf450 100644 --- a/lib/ruby_dep/ruby_version.rb +++ b/lib/ruby_dep/ruby_version.rb @@ -36,6 +36,9 @@ def recommended(status) }, 'jruby' => { + '2.5.0' => :unknown, # jruby-9.2.0.0 + '2.3.3' => :unknown, # jruby-9.1.10.0, jruby-9.1.12.0, jruby-9.1.13.0 + '2.3.1' => :unknown, # jruby-9.1.7.0, jruby-9.1.8.0 '2.3.0' => :unknown, # jruby-9.1.2.0, jruby-9.1.0.0 '2.2.3' => :buggy, # jruby-9.0.5.0 '2.2.0' => :insecure diff --git a/lib/ruby_dep/travis.rb b/lib/ruby_dep/travis.rb index 5176a5a..d11b193 100644 --- a/lib/ruby_dep/travis.rb +++ b/lib/ruby_dep/travis.rb @@ -1,3 +1,4 @@ +require 'tmpdir' require 'yaml' require 'ruby_dep/travis/ruby_version' diff --git a/lib/ruby_dep/travis/ruby_version.rb b/lib/ruby_dep/travis/ruby_version.rb index 275aec4..7abb88e 100644 --- a/lib/ruby_dep/travis/ruby_version.rb +++ b/lib/ruby_dep/travis/ruby_version.rb @@ -47,12 +47,27 @@ def version_for(travis_version_string) match[:version] # if match[:engine] == 'ruby' end + JRUBY_VERSIONS = { + '9.2.0.0' => '2.5.0', + '9.1.17.0' => '2.3.3', + '9.1.16.0' => '2.3.3', + '9.1.15.0' => '2.3.3', + '9.1.14.0' => '2.3.3', + '9.1.13.0' => '2.3.3', + '9.1.12.0' => '2.3.3', + '9.1.10.0' => '2.3.3', + '9.1.8.0' => '2.3.1', + '9.1.7.0' => '2.3.1', + '9.1.2.0' => '2.3.0', + '9.1.0.0' => '2.3.0', + '9.0.5.0' => '2.2.3', + '9.0.4.0' => '2.2.2' + }.freeze + def jruby_version(version) - return '2.3.0' if version == '9.1.2.0' - return '2.3.0' if version == '9.1.0.0' - return '2.2.3' if version == '9.0.5.0' - return '2.2.2' if version == '9.0.4.0' - raise Error::Unrecognized::JRubyVersion, version + JRUBY_VERSIONS.fetch(version) do + raise Error::Unrecognized::JRubyVersion, version + end end end end diff --git a/spec/lib/ruby_dep/travis/ruby_version_spec.rb b/spec/lib/ruby_dep/travis/ruby_version_spec.rb index 0d02530..75d8430 100644 --- a/spec/lib/ruby_dep/travis/ruby_version_spec.rb +++ b/spec/lib/ruby_dep/travis/ruby_version_spec.rb @@ -88,5 +88,12 @@ expect(subject.segments).to eq([2, 3, 0]) end end + + context 'with JRuby 9.1.13.0' do + let(:travis_version_string) { 'jruby-9.1.13.0' } + it 'returns the Ruby implementation version segments' do + expect(subject.segments).to eq([2, 3, 3]) + end + end end end diff --git a/spec/lib/ruby_dep/travis_spec.rb b/spec/lib/ruby_dep/travis_spec.rb index cafb967..84dedda 100644 --- a/spec/lib/ruby_dep/travis_spec.rb +++ b/spec/lib/ruby_dep/travis_spec.rb @@ -76,6 +76,27 @@ expect(subject.version_constraint).to eq(['~> 2.3', '>= 2.3.0']) end end + + context 'with version 9.1.7.0' do + let(:yml) { YAML.dump('rvm' => %w(jruby-9.1.7.0)) } + it 'pessimistically locks with correct initial supported version' do + expect(subject.version_constraint).to eq(['~> 2.3', '>= 2.3.1']) + end + end + + context 'with version 9.1.13.0' do + let(:yml) { YAML.dump('rvm' => %w(jruby-9.1.13.0)) } + it 'pessimistically locks with correct initial supported version' do + expect(subject.version_constraint).to eq(['~> 2.3', '>= 2.3.3']) + end + end + + context 'with version 9.2.0.0' do + let(:yml) { YAML.dump('rvm' => %w(jruby-9.2.0.0)) } + it 'pessimistically locks with correct initial supported version' do + expect(subject.version_constraint).to eq(['~> 2.5', '>= 2.5.0']) + end + end end context 'with multiple versions' do