我找不到可以回答这个问题的 SO QA。
我通过rvm install jruby
安装了JRuby,然后生成了一个新的rails应用程序。为了允许通过 rvm 自动更改 ruby 版本,我发现 Bundler 允许您添加:
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.12'
请参阅此处 reference 。由于这是 1.3,我在根应用程序目录中检查了 Bundler 版本:
$ bundle -v
Bundler version 1.6.2
我假设我有这个功能。现在,当我将其添加到 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'
然后在运行 cd .. && cd app
后我收到了这个问题:
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.
你知道如何告诉rvm选择jruby版本吗?在 Gemfile 中可以吗?
最佳答案
正如已经链接到 RVM reports Gemfile ruby as not installed 的评论所建议的那样
RVM 对从 Gemfile 解析 Ruby“引擎”的支持是有限的,并且与 Heroku 使用(解析)指令的方式不匹配。
如果您确实希望将两者都包含在 Gemfile 中,请使用 RVM 注释,例如
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"
# ...
关于ruby-on-rails - 在 Bundler 中指定 JRuby 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24102563/