Rubymine not recognizing installed gems - ruby

My Ruby project is not recognizing the gem I just installed in Terminal. The gem is also not showing up in external libraries.

This problem is fixed in RubyMine 5.0

Related

RubyMine debug gem versions different from public gem versions

I am using RubyMine version 2021.1 on Mac OS (10.15.7, Catalina) and Ubuntu.
I am having difficulty getting the debugging gem installation to work with a custom Ruby that is outside of my rvm environment, and noticed that the debugging gems that RubyMine is trying to install on my behalf have versions different from the public ones:
Gem
Latest Public Version
RubyMine Version
debase
0.2.4.1
2.3.2
ruby-debug-ide
0.7.2
2.3.1
Why is this? Does RubyMine have its own proprietary versions of these gems?
Looking at the gemspec, these gems have been "forked" by JetBrains and the RubyMine's come from their proprietary repos (https://github.com/JetBrains):
s.homepage = "https://github.com/JetBrains/debase".
Hence there are differences in versions.

Bundle not working with rbenv and cannot gem install bundler

I was running into an issue with bundler when using rbenv. I had switched from ruby 2.3.1 to 2.5.1 a while ago, but I noticed the following error when trying to run bundler inside of a shell script in an ansible task.
```
rbenv: bundle: command not found
The `bundle' command exists in these Ruby versions:
2.2.2
2.3.1
```
I saw some solutions to this where you had to install bundler when on a specific ruby version. However even uninstalling bundler and reinstalling it did not resolve the issue. It seemed due to some gem issue that I could not install bundler on specific ruby versions, thus reinstalling bundler did nothing for me.
However I did find a very manual solution to this.
I noticed how rbenv whence bundle specified that bundle was active in some ruby versions, but not others. I tracked down the portion of rbenv whence command to find out where it was looking and saw that it looked under the following path for each ruby version installed under rbenv: ~/.rbenv/versions/$VERSION/bin/
If you look under the path for the gem without bundler (for me this was ~/.rbenv/versions/2.5.1/bin/) you will notice that it is not there. However under other versions that whence can recognise you will see the executable is there (for me it was there under ~/.rbenv/versions/2.3.1/bin/bundle and ~/.rbenv/versions/2.3.1/bin/bundle).
So I copied the executable over from the working ruby version to the one that was broken. Then at the top of the file you will notice sha-bang is set to the other ruby version (for me this was #!/Users/myuser/.rbenv/versions/2.3.1/bin/ruby). Change the version path to the ruby version you want to fix and then it will all magically start working.
I would highly recommend that you run your ansible scripts in an environment without rbenv. In other words, it is preferable to be using vagrant or a VM to practice your scripts in.
If your project really needs rbenv, please use the ansible rbenv library to work with it, but running it on your host machine is a dangerous way to develop because it is not easily reversible.
Hope this helps!

Bundler using wrong gem when specifying a forked version from github

I've been having some serious pains getting rubymine to use a gem version specified by my bundler.
source "https://rubygems.org"
gem "sinatra"
gem "slim"
gem "dm-core"
gem "dm-migrations"
gem "rbing", :git => "https://github.com/KellyMahan/rbing.git"
When I run bundle install, it seems to download correctly.
Using rbing (1.1.0) from https://github.com/KellyMahan/rbing.git (at master) Enter your password to install the bundled RubyGems to your system:
Yet every time, low and behold, I am to discover the gem currently being used as listed in my "External Libraries" directory in RubyMine, it is using the old version of the gem, and not the forked version from github.
Ideas? Any help is very much appreciated.
-Adam
EDIT:
Also, could it be possible there could be any issues with the rvm I'm using to use 2.0.0 that RubyMine is using as my default gem location. Could the forked version be downloaded to somewhere other than this rvm path that my RubyMine uses by default?
EDIT again:
I updated the unregisted git root that was rbing, and after I even successfully made the commit and changes were made.....it didn't affect the version of rbing sitting in my external library directory. Any help to figure this out will be unbelievably appreciated, it's driving me nuts.
Did you tried using gem uninstall to uninstall the old version?
If you don't know how, check this
It is the case that git gems are installed by bundler in a different location than the normal gem path, but RubyMine has bundler integration and should be able to find the gem normally. Try running Bundler - Install from inside RubyMine and see what happens. It might be using a different Ruby version or there could be some other issue.
There seems to have been a bug in RubyMine 5.x that was fixed in version 6.0 related to the "External Libraries". Please see this issue:
http://youtrack.jetbrains.com/issue/RUBY-14584
Upgrading to version 6.0 RC seems to fix it.

reinstall every gem for each ruby version?

I just installed Ruby 2.0.0 using rbenv and set it to the global ruby version for my system. Since 2.0 is compatible with 1.9.3, I tried to start up a Rails project with it, but got the following error. I did rbenv rehash after installing 2.0
The `rails' command exists in these Ruby versions:
1.9.3-p327
Does this mean that every gem I installed on my system with 1.9.3 has to be reinstalled if I wish to use it with 2.0?
As seen here:
You need to reinstall bundler for each version of Ruby you use. See Ruby versions where you have it installed:
rbenv whence bundle
See your current version:
rbenv version
Install bundler for that version, if missing:
gem install bundler
Yes. Rbenv (and RVM) have separate "gem home" directories for each installed version of Ruby. There may be ways to symlink certain directories to get them to share, but this will likely lead to problems, particularly with gems that include native C extensions, which may or may not compile and run cleanly in multiple versions.
If you have a Gemfile, easiest thing is to just bundle install again for Ruby 2.0, giving you duplicate copies of many gems and Ruby-2.0 compiled versions of any native gems.
Another solution to this is to copy (or reinstall) the gems from your previous version to the newly installed version. How to do that is answered in detail in this question, which has two scripts -- one to install from local cache, one to reinstall from the internet (mine).

Omniauth (net-ldap requires Ruby version >= 1.8.7.) installation error?

I'm trying crazily to install omniauth on Ubuntu 8.04.4.
I keep getting the following error:
ERROR: Error installing omniauth:
net-ldap requires Ruby version >= 1.8.7.
So I updated to Ruby1.9 but still the error persists. Any idea of why this is happening?
I thought ruby1.8.7 was a minor release, so best practice would suggest moving to Ruby1.9. Further, and more to the point, I can't find a copy of Ruby1.8.7 anywhere.
EDIT:::::::::::::::
I purged the gems and uninstalled ruby. Then found a version ruby1.8.7, compiled and installed and now it works great.
Cheers,
Slotishtype.
I guess since you have "updated" and not removed the old Ruby version, the gems would be installed to old path where the old Ruby version was installed.
You can verify the same using the command
gem env
in the terminal. And following the path to where your gems are currently installed.
Also you can check if you have the correct ruby version installed as per your requirement with
ruby -v
Try removing the old version and then installing a fresh version of Ruby.
You would find Ruby 1.8.7 from http://www.ruby-lang.org/en/downloads/.
Good Luck!!
Hope it helps.

Resources