Working with Multiple Projects in RubyMine
Introduction
It is common for a developer to work on several projects at once. Keeping that in mind, RubyMine allows working with several projects in separate windows or even in one window. Being opened in different windows, the projects are independent, and cannot share information, except for the Clipboard operations.
But RubyMine also allows you to have one main project within which you can add as many projects as you like in one IDE window. This tutorial aims to show how several projects can be managed in one window.
Opening several projects in one frame
Any opened project may become the main project after another one is added. The main project is always placed at the top of the list of projects in all views and in the Settings/Preferences. So first of all, open the project supposed to be the main one (here learn-rails
).
To add another project (app
) to the main one, go to on the main menu, and in the Open Project dialog select the checkbox Add to currently opened projects under the option Open in current window:
The app
project appears in the tree, and if you expand the node, you can see the whole structure of this project. The Ruby SDK related to the project is available as well:
Once the project was added, you can delete it from the list. To remove any project (except the main one), navigate to it in the Project tool window, right-click it and choose the command Remove from Project View:
If the window with several projects has been closed, you can reopen it (
).Managing SDK and gems
To change Ruby SDK for a project, go to the Settings/Preferences and click the page Ruby SDK and Gems. All projects are displayed in the list, each one having its own SDK. Select a project and then select its SDK:
To add a new SDK, click :
All SDKs are available with their gems.
Navigating through the source code
Files from all the opened projects are available for navigation. For example, when navigating to a class ( or Ctrl+N), the name of a project appears to the right:
Using Rails Generators, Bundler commands, Rake tasks, diagrams, etc.
To invoke any action for a project, such as Rails generator (
), Rake task ( ), Bundler command ( ), and others, first you need to specify the context.Selecting a context means that a project is selected in the project tree or a file from this project is opened in the editor and has the focus.
Navigation bar serves a good prompter, as it always shows the context:
For example, select the project before invoking the generator's list:
Running and debugging
When several projects are opened in one window, run configurations are created with the name of the project as a postfix: