RubyMine doesn't recognize gem from git repository

时光总嘲笑我的痴心妄想 提交于 2019-12-10 16:40:15

问题


We have a git repository with a custom gem. To install it Gemfile has a line:

gem 'my-gem', :git => 'git@192.168.1.100:my-gem.git'

After installing the gem, it is not shown in RubyMine`s External Libraries.

How to make the gem be shown in External Libraries and code from the gem be autocompleted?


回答1:


We get this error as well, so it's probably a bug in RubyMine. A workaround is to check out that gem repo and tell bundler to use it. Note that the remote repository will not be used anymore.

bundle config local.my-gem /path/to/my-gem/
bundle install

Then open my-gem by adding it to your existing window in rubymine as explained here. This made forward navigation and code completion work for us.




回答2:


A bug relating to detecting gems installed from git with bundler was fixed in RubyMine 2017.1. That bug referenced the bundler method git_source, but duplicates of that bug did not reference that method, so it seems to have been a general problem with recognizing gems installed from git with bundler. So upgrade to 2017.1 or later for such gems to be recognized more often than in previous versions.

In the most recent version available, 2017.2 EAP 5, there is still a bug in recognizing gems installed from git by bundler on the command line. If you've done that and the gem doesn't appear in External Libraries etc., you can do any of the following:

  • bundle install from inside RubyMine (Tools → Bundler → Install)
  • quit and restart RubyMine
  • edit Gemfile trivially, such as by editing whitespace, so that RubyMine notices that something has changed


来源:https://stackoverflow.com/questions/20782589/rubymine-doesnt-recognize-gem-from-git-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!