Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RubyMine doesn't recognize gem from git repository

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

gem 'my-gem', :git => '[email protected]: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?

like image 561
Aleksei Smoliakov Avatar asked Nov 01 '22 08:11

Aleksei Smoliakov


2 Answers

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.

like image 72
Pierre Pretorius Avatar answered Nov 15 '22 04:11

Pierre Pretorius


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
like image 30
Dave Schweisguth Avatar answered Nov 15 '22 05:11

Dave Schweisguth