Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose particular gem in Gemfile based on current RVM?

Tags:

rvm

jruby

How can I conditionally choose which gem to use based on the Ruby VM currently in use?

Ideally I would like something like:

if [using jruby]
    gem 'jruby-openssl'

This would only require the jruby-openssl if the RVM being used is JRuby.

like image 498
ryan Avatar asked Dec 05 '22 20:12

ryan


1 Answers

Use the following in your Gemfile, as documented here: https://github.com/jruby/activerecord-jdbc-adapter

platforms :ruby do
  gem 'sqlite3'
end

platforms :jruby do
  gem 'jruby-openssl'
  gem 'activerecord-jdbcsqlite3-adapter'
end
like image 185
Eric Dobbs Avatar answered Mar 02 '23 18:03

Eric Dobbs