How to select a specific stone in the Gemfile based on the current RVM?

How can I conditionally choose which stone to use based on the currently used Ruby VM?

Ideally, I would like something like:

if [using jruby] gem 'jruby-openssl' 

This will only require jruby-openssl if RVM is used by JRuby.

+4
source share
2 answers

Trying to answer my own question here.

We can do this using the following Gemfile directive:

 if defined?(JRUBY_VERSION) gem 'jdbc-sqlite3' else gem 'sqlite3' end 
+4
source

Use the following in the Gemfile: https://github.com/jruby/activerecord-jdbc-adapter

 platforms :ruby do gem 'sqlite3' end platforms :jruby do gem 'jruby-openssl' gem 'activerecord-jdbcsqlite3-adapter' end 
+12
source

All Articles