Configuring SDK Gemsets
On this page:
Introduction
Gemsets are a convenient way to deal with the different gem environments for your applications. RubyMine supports both rvm and rbenv gemsets.
List of Ruby SDKs
To view the list of Ruby SDKs, available to the computer, follow these steps
- Open Setting/Preferences dialog. See section Accessing Settings
- Under the node Languages and Frameworks, click the page Ruby SDK and Gems .
- Select the desired project (if there are several projects opened in the same window) and see the list of Ruby SDKs:
To select an SDK for a project, click the radio button to the left of the desired Ruby SDK, or press Space.
Note the following:
- When the page Ruby SDK and Gems opens, the node that contains the project SDK is expanded.
- RubyMine automatically detects Ruby versions installed.
- Add or remove any local or remote SDKs with the buttons and .
- Expand/collapse buttons / are only available for OS X and *NIX platforms, as the ones having gemsets. For Windows platform, these buttons are disabled.
- Speed search works for the list SDKs.
List of gemsets
For each SDK, open the list of available gemsets.
To view the list of gemsets for the selected SDK, follow these steps
Note that the previous selection of a gemset per project is preserved. You can quickly return to it by merely selecting the SDK in question.
RVM gemset
If you haven’t specified any RVM gemset to use with the project yet, then the default and global gemsets are selected.
However, one can select any desired gemset by hitting Space or clicking the radio button to the left of the gemset name.
It's also possible to decide whether to use the global gemset
(hit Space, or select/clear the check box). Global gemset (if selected) is used to
share gems to all the gemsets within an SDK.
The default gemset
, marked with a radio button, is used for any specific interpreter.
Creating rvm gemsets
For configuring rvm
gemsets, one should use the files .ruby-gemset
and
.ruby-version
. Refer to the
rvm documentation.
Rbenv gemset
For rbenv, the default
gemset means the set
of gems installed to the SDK folder, so you cannot unselect it (the check box to the left is disabled).
global
gemset has no special behavior.
rbenv
enables you to select as many gemsets as required (hit Space, or
select/clear the check box to the left of the desired gemset).
Creating rbenv gemsets
Prerequisite
Before you start working with rbenv, make sure that rbenv-gemsets plugin is installed and enabled. The plugin is not bundled with RubyMine.
There are the following ways of creating gemsets: using the
commands of the rbenv-gemsets
plugin, or using the
.rbenv-gemset
file.
To create a gemset commands of the rbenv-gemsets plugin, follow these steps:
- Open the Terminal tool window.
- Enter command in the format
rbenv gemset create <rbenv version number> <gemset name>
For example:
To create a rbenv gemset in the editor, follow these steps:
- Open for editing the file
.rbenv-gemset
(if the file does not exist, create it). - Type the new gemset name. The following steps depend on the existence of a gemset:
- If the gemset with the entered name exists, the completion is suggested:
- If the gemset with the entered name does not exist, then press Alt+Enter and choose the intention action Create gemset <gemset name>:
Refer to the rbenv documentation.
As a result, the created gemset appears in the Ruby SDK and Gems page of the Settings/Preferences dialog. Note that this gemset is already selected.
List of gems
In the right-hand pane of the Ruby SDK and Gems dialog, there is the list of gems, available for an SDK or a gemset.
If you select an SDK, you'll see see all the gems available for the current project with that version. So doing, the gems of all gemsets are selected for the SDK in question.
Note the following:
- If an SDK has no gemsets (as on Windows platform), then all the gems installed with the selected SDK are shown in the right-hand pane.
- If an SDK has gemsets (as on OS X or *NIX platforms), then, when one selects a gemset, the gems for the
selected gemset are shown in the right-hand pane. This is valid for both
rvm
andrbenv
. - If an SDK has gemsets, and this SDK is selected, then the contents of the right-hand pane depends on the
version manager used:
rbenv
: the gems list shows all the gems from all the gemsets. So doing, the gems in the gems list have the note from which gemset they are taken. Same is valid for the External Libraries node in the Project tool window.rvm
: the gems list shows both theglobal
gemset and one gemset selected (by default, this is thedefault
gemset). So doing, the gems list bears no marking, as well as the External Libraries node in the Project tool window.
Speed search also work for the gems: just type a string, and speed search shows the matching entries only:
It's also possible to see the gem path, using the button , and the web page with the gem description, using the button .