BenMorganIO
BenMorganIO

Reputation: 2046

Specifying JRuby Version in Bundler

I wasn't able to find a SO QA that could answer this.

I installed JRuby via rvm install jruby and then generated a new rails application. To allow for changing of the ruby version automatically via rvm, I discovered that Bundler allows you to add:

ruby '1.9.3', engine: 'jruby', engine_version: '1.7.12'

See here for reference. Since this is 1.3, I checked my Bundler version within my root app directory:

$ bundle -v
Bundler version 1.6.2

I'm assuming I have this functionality. Now, when I move onto adding this to Gemfile:

source 'https://rubygems.org'
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.12'

gem 'rails', '4.1.1'
gem 'activerecord-jdbcsqlite3-adapter'

And then after running cd .. && cd app I received this issue:

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore  /Users/benmorgan/Sites/sigma/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

Unknown ruby string (do not know how to handle): ruby-1.9.3,engine:jruby,engine_version:1.7.12.

Do you know how to tell rvm to select the jruby version? Is it possible within the Gemfile?

Upvotes: 2

Views: 1177

Answers (1)

kares
kares

Reputation: 7181

as suggested by the comment already linking to RVM reports Gemfile ruby as not installed

RVM's support for resolving a Ruby "engine" from the Gemfile is limited and does not match how Heroku is using (parsing) the directive.

if you really want to have it both in the Gemfile use a comment for RVM e.g.

source "https://rubygems.org"
#ruby=jruby-1.7.12
if ENV["JRUBY"] || RUBY_PLATFORM == "java"
  ruby "1.9.3", engine: "jruby", engine_version: "1.7.12"
end

gem "rails", "~> 4.1.1"
# ...

Upvotes: 3

Related Questions