It's 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.

1. Opening Several Projects in One Window

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. So first of all open the project supposed to be the main one (railsapp1).

To add another project (railsapp2) to the main one, go to

{span:class=shortcut}File \| Open...{span}
menu, and in the Open Project dialog check the
{span:class=shortcut}Open in current window \-> Add to currently opened projects{span}

The railsapp2 project appears in the tree and if you expand the node, you can see the whole structure of the 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 tree, right-click it and choose the

{span:class=shortcut}Remove from Project View{span}

If the window with several projects was closed you can reopen it with a help of

{span:class=shortcut}File \| Open Recent{span}
menu. Multiple projects will be separated by a comma started with the main one:

Please aware that you can add projects to the main project only one by one. You cannot add any project from

{span:class=shortcut}File \| Open Recent...{span}
menu. Please always use
{span:class=shortcut}File \| Open...{span}
menu. You can also add a new project to the list with a help of
{span:class=shortcut}File \| New Project...{span}

2. Managing SDK and Gems

To change the settings of Ruby SDK for a project, go to the

{span:class=shortcut}Settings \-> Ruby SDK and Gems{span}
. All projects will be displayed in the list. Select a project and then select an SDK:

To add a new SDK, click

under the list:

All SDKs are available with related gemsets in the list. To install/update gems, press

under the list of gems:

3. Navigating Through the Source Code

Files from all opened projects are available for navigation. For example when navigating to a class (

{span:class=shortcut}Navigate \| Class...{span}
) the name of the project appears in the right:

4. Using Rails Generators, Bundler Commands, Rake Tasks, Diagrams, etc.

To invoke any action for the project such as Rails generator (

{span:class=shortcut}Tools \| Run Rails Generator...{span}
), Rake task (
{span:class=shortcut}Tools \| Run Rake Task...{span}
), Bundler command (
{span:class=shortcut}Tools \| Bundler{span}
), and others, first you need to set 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 (
{span:class=shortcut}View \| Navigation Bar{span}
) can be a good context prompter as it always shows the context selected:

For example, select the project before invoking the generator's list:

2. Running and Debugging

When several projects are opened in one window run configurations are created with the name of the project as a postfix:

So to run/debug/test the project, use one of the default run configurations or create a new one. Creating a new run configuration requires choosing the context first.

7. Working with Version Control Systems

If there is no VCS set up for the main project go to

{span:class=shortcut}VCS \| Enable Version Control Integration...{span}
and choose VCS you want to use:

To enable the version control integration for any secondary project please use the terminal (

{span:class=shortcut}Tools \| Open Terminal...{span}
) first. For example init Git integration for railsapp2:

Then go to

{span:class=shortcut}Settings \-> Version Control{span}
and register the Git root:

Please don't use

{span:class=shortcut}VCS \| Enable Version Control Integration...{span}
for secondary projects because of the known issue.

Now, when projects are aded to version control, all VCS commands are available for both projects:

8. Deploying Several Projects

Deployment settings are also defined per project. When deploying to a remote host, you can set the mapping in

{span:class=shortcut}Settings \-> Deployment{span}
for each project if you need:

When you use the Capistrano framework, just select the context and capify the application. Capistrano tasks will be available if the corresponding project have a context.