We're doing some A/B testing on MRI vs JRuby for a microservice we've written.
I need my server or any local developer to use a specified version of JRuby or MRI.
I've read through Bundler's docs and thought I understood the use of ruby engine's to be used like this:
platforms :jruby do
ruby '1.9.3', engine: :jruby, engine_version: '1.7.19'
gem 'bson'
end
platforms :ruby do
ruby '2.2.0', engine: :ruby, engine_version: '2.2.0'
gem 'bson_ext'
end
However if I do $which ruby
I get: .rvm/rubies/jruby-1.7.19/bin/ruby
and then run bundle install
I get:
Your Ruby engine is jruby, but your Gemfile specified ruby
How can I use bundler with platforms to specify a ruby version specific to the platform the user/server is running?
as of current Bundler
you can not do that, since :platforms
only apply to gem
declarations ... closest thing you can get is a "runtime" decision logic based on which Ruby loads the Gemfile :
if defined? JRUBY_VERSION
ruby '1.9.3', engine: :jruby, engine_version: '1.7.19'
else
ruby '2.2.0', engine: :ruby, engine_version: '2.2.0'
end
platforms :jruby do
gem 'bson'
end
platforms :ruby do
gem 'bson_ext'
end