简体   繁体   English

RubyMine无法识别我的Ruby安装路径

[英]RubyMine doesn't recognize my Ruby installation path

I've made a custom sient installer of Ruby 2.0 with some gems and extras , my installer expands all the Ruby files to c:\\Program Files (x86)\\Ruby , the interpreter ( ruby.exe ) is in the Bin folder, all is as normally but just it's not an original installation, I expand the files and I add the registry keys to associate files by my own, I can run Ruby as normally ever I want. 我用一些宝石其他东西制作了一个定制的Ruby 2.0安装程序,我的安装程序将所有Ruby文件扩展到c:\\ Program Files(x86)\\ Ruby ,解释器( ruby.exe )在Bin文件夹中,所有与通常情况一样,但不是原始安装,我扩展了文件,并添加了注册表项以自行关联文件,我可以按需要正常运行Ruby。

Now, is the first time that I try the JetBrains RubyMine IDE, and I can't found a simple guide which explains how to set the Ruby directory, seems that this IDE assumes that the Ruby installation is original and maybe takes a registry value from the original Ruby installer to know the Path or something, I don't know, but just I didn't see any help about how to set the Ruby directory manually. 现在,这是我第一次尝试使用JetBrains RubyMine IDE,但找不到一个简单的指南来解释如何设置Ruby目录,似乎该IDE假定Ruby安装是原始的,并且可能从我不知道原始的Ruby安装程序知道Path或其他内容,但是我没有看到有关如何手动设置Ruby目录的任何帮助。

(I have the same problem for PyCharm) (我对PyCharm也有同样的问题)

Anyways I've tried to set it from the Ruby SDK and Gems option, the dialog-box says "select Ruby interpreter Path", but I'm on the Path and it's not recognized, I mean that the Ok button still disabled: 无论如何,我都尝试从Ruby SDK和Gems选项进行设置,对话框中显示“选择Ruby解释器路径”,但是我在该路径上并且无法识别,我的意思是“ 确定”按钮仍然处于禁用状态:

在此处输入图片说明

Then I'm missing the right option anywhere? 那我在任何地方都缺少正确的选择吗? or really a professional and expensive IDE like this doesn't has support just to specify the location of Ruby in these circunstance where an user does not use the original Ruby installer? 还是真的像这样的专业且昂贵的IDE不支持仅在用户不使用原始Ruby安装程序的情况下指定Ruby的位置? I really will think not . 我真的不会认为

In my experience it is more preferable to set your PATH environment variables appropriately instead of trying to locate executables on a per-app basis. 以我的经验,最好是适当地设置PATH环境变量,而不是尝试按应用定位可执行文件。

You can set your path so that the desired Ruby takes precedence over any other rubies and I am sure that RubyMine will pick it up (or just use ruby and let your PATH specify which to use). 您可以设置路径,以便所需的Ruby优先于其他任何红宝石,并且我确信RubyMine会选择它(或仅使用ruby并让您的PATH指定要使用的红宝石)。

On another note you might also want to have a look at a ruby version manager such as rbenv or RVM. 另一方面,您可能还想看看Ruby版本管理器,例如rbenv或RVM。

Update : Just tried to set manually a Ruby SDK in the latest version of RubyMine (6.3) and it worked as expected. 更新 :刚刚尝试在最新版本的RubyMine(6.3)中手动设置Ruby SDK,并且按预期工作。 I had, however, to expand the folder in which the binary resided (in your case bin ), select the actual binary and then click OK. 但是,我必须展开二进制文件所在的文件夹(在您的情况下为bin ),选择实际的二进制文件,然后单击“确定”。 Have you tried that as well? 你也尝试过吗?

If you have two JRuby versions installed and one of them is not recognized: 如果您安装了两个JRuby版本,但其中一个无法识别:

  • Add both bin directories to your PATH (like in Kostas Rousis's answer above), 将两个bin目录都添加到您的PATH (就像上面的Kostas Rousis的回答一样),
  • set JRUBY_HOME to the one version you want to use and JRUBY_HOME设置为您要使用的版本,然后
  • restart RubyMine. 重新启动RubyMine。

In my case, I have the version 1.6.8 and 9.1.13.0 installed. 就我而言,我安装了1.6.8和9.1.13.0版本。 Setting JRUBY_HOME to the newer version I can use both versions. JRUBY_HOME设置为较新的版本,我可以同时使用两个版本。 However setting JRUBY_HOME to the older version, RubyMine only recognises the older version, even when I navigate to the newer version's folder. 但是将JRUBY_HOME设置为旧版本,即使我导航到新版本的文件夹,RubyMine也只能识别旧版本。 That's a really weird behavior but I'll take it. 这是一个非常奇怪的行为,但我会接受。 I still remember that it worked properly in earlier versions of RubyMine though (I'm currently at 2017.2.4). 我仍然记得它在早期版本的RubyMine中可以正常工作(我目前在2017.2.4)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM