RubyMine 8 Beta: Rbenv Gemsets
Hello everyone,
We’d like to apologize for not making any EAP builds available for the last two weeks. We’ve been polishing one of the major features of the upcoming release – support of rbenv gemsets, which we wanted to make ready for the Beta. Today we’re happy to announce RubyMine 8 Beta is available to download and try!
We continue our series of blog posts about the major new features of the upcoming RubyMine release: Bundler Support Improvements, React Support Improvements, New Debugging Option, New UI for Testing, Adjustments for Color Deficiency, Faster Debugger, IDE Look and Feel Improvements.
Rbenv Gemsets
RubyMine has supported RVM gemsets for a while, and we’ve been asked to add support for rbenv gemsets as well for quite a while. Unlike RVM, rbenv doesn’t have native gemset functionality, but thanks to rbenv-gemset plugin using gemsets with rbenv now seems to be quite common.
To show you rbenv support features, let’s assume I have rbenv SDK with ruby-debug-ide (0.5.0) gem installed. But I want to use ruby-debug-ide (0.6.0) for my project and want to manage it with a gemset.
Creating a new gemset
I’m going to start with creating a new gemset. There are two ways to create a new gemset in RubyMine. First of all you can simply use Terminal as you are used to:
You can also add a .rbenv-gemset file to your project and add a new gemset name to it. Every time you invoke a Bundle command or change a gemfile, RubyMine checks .rbenv-gemset file and creates gemsets listed there if they don’t exist. Just make sure rbenv sdk is chosen in your project settings:
Managing list of gemsets
You can always check what gemsets are switched on in your project in Preferences | Languages & Frameworks | Ruby SDK and Gems:
If you want to switch your gemset off or on, please use button.
Every time you change a list of project gemsets, .rbenv-gemset file is updated accordingly. And vice versa, every time you change .rbenv-gemset file, project settings are changed. Please note you can also use code completion inside .rbenv-gemset for both gemsets and local project directories:
Managing gems in a gemset
Every time you install a new gem, whether with the help of Bundler or not, it will be installed into a gemset that is listed first in .rbenv-gemset file. If there are no gemsets (no .rbenv-gemset file) in a project, the gem will be installed directly into rbenv SDK folder.
In my example I want to install ruby-debug-ide (0.6.0) to the gemset I’ve created. So I need to specify a version in my gemfile and run the Bundle install command (Tools | Bundler | Install):
To see the list of gems available for a project, look in the External Libraries directory. Now we have ruby-debug-ide (0.6.0) available here:
Please note that we are still working on the feature and there may be issues, which we ask you to report to our issue tracker so we can polish it for the final release.
The full list of fixed issues can be found in the release notes.
Please take a look at all the new RubyMine 8 features, download and try it from our site.
—
Develop with pleasure!
JetBrains RubyMine Team