4

In my Gemfile, I have specified:

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

But entering my Rails project directory makes rvm throw up this error:

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 /home/petey/rails/kotoba/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. ruby-1.9.3,engine:jruby,engine_version:1.7.9 is not installed. To install do: 'rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9' 

However, I do have jruby 1.7.9 installed:

$ rvm list rvm rubies jruby-1.7.9 [ x86_64 ] ruby-1.9.3-p392 [ x86_64 ] =* ruby-2.0.0-p247 [ x86_64 ] # => - current # =* - current && default # * - default $ rvm use jruby Using /home/petey/.rvm/gems/jruby-1.7.9 $ ruby -v jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64] 

In fact, I can even select it with rvm use jruby and rails works fine.

Is there a problem with the ruby directive in the Gemfile?

I followed the official specification, which has a very similar example.


Edit: On running rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9 at the prompt, rvm proceeds to install ruby-1.9.3-p484. And once again, it shows the same error message on entering the project directory:

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 /home/petey/rails/kotoba/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. ruby-1.9.3,engine:jruby,engine_version:1.7.9 is not installed. To install do: 'rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9' 
5
  • What happens if you run rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9? Does it tell you it's already installed? Commented Jan 6, 2014 at 7:18
  • @AlexSiri It starts downloading ruby-1.9.3-p484 (MRI and not jruby). I'll let it finishing downloading, check rvm's behavior and report back. Commented Jan 6, 2014 at 8:18
  • It's Probably not going to download or use the jruby version Commented Jan 6, 2014 at 8:20
  • @AlexSiri Yeah, it doesn't seem to. Updated my post. Commented Jan 6, 2014 at 8:29
  • I think you should better create a .ruby-version file, which rvm will use before loading bundler, the Gemfile, and any other files Commented Jan 6, 2014 at 8:33

1 Answer 1

7

According to this SO answer:

RVM has limited support of the ruby directive, you can use comment to overwrite what will be used by RVM.


By adding:

#ruby=jruby-1.7.9 

to the Gemfile just below the ruby directive, rvm seems to be able to pick the right ruby:

$ cd kotoba 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 /home/petey/rails/kotoba/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. $ ruby -v jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.