Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support newer JRubies #35

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions lib/ruby_dep/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_dep/travis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'tmpdir'
require 'yaml'

require 'ruby_dep/travis/ruby_version'
Expand Down
25 changes: 20 additions & 5 deletions lib/ruby_dep/travis/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/ruby_dep/travis/ruby_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions spec/lib/ruby_dep/travis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down