RubyMine 2021.1 Help

Projects

Whatever you do in RubyMine, you do that in the context of a project. A project is an organizational unit that represents a complete software solution. It serves as a basis for coding assistance, bulk refactoring, coding style consistency, and so on.

A project in RubyMine is represented in the Directory Based Format. A root project directory contains the .idea directory, with the following files:

  • .iml file that describes the project structure.

  • workspace.xml file that contains your workspace preferences.

  • A number of xml files. Each xml file is responsible for its own set of settings, that can be recognized by its name: projectCodeStyle.xml, encodings.xml, vcs.xml, and so on.

    Thus, for example, adding a new run/debug configuration and changing encoding will affect two different xml files. This helps avoid merge conflicts when the project settings are stored in a version control system and modified by the different team members.

The .idea directory is not visible in the Project view of the Project tool window Alt+1.

Once you have opened a folder in RubyMine, the .idea subfolder is added to it where RubyMine stores its internal configuration settings, for example, for the project code style or the version control system.

In this section:

A project in RubyMine is a folder with the source code you edit, various application configuration files (for example, Gemfile or package.json), and the external libraries. It serves as a basis for coding assistance, refactoring, coding style consistency, and so on.

In this topic, we'll show you how to create new projects, open and close projects, and work with several projects in one window.

Create projects

Create an empty Ruby project

  1. Click Create New Project on the Welcome screen or select File | New Project from the main menu.

  2. In the dialog that opens, select Empty Project in the left-hand pane and specify the following settings:

    Creating a new empty project
    • Location: Specify a project's location and name (ruby-helloworld in our case).

    • Ruby SDK: Select a required Ruby interpreter installed on your system.

    Click Create.

  3. (Optional) In the opened dialog, choose whether you want to attach a new project to the opened one, open a new project in a new window, or close the current project and reuse the existing window.

    Open the project in the current window, new window, or attach it to the existing project

Check out a project from Version Control

  1. Click Get from Version Control on the Welcome screen or select VCS | Get from Version Control from the main menu.

  2. In the invoked dialog, select your version control system from the list and specify the repository to check out the application sources from. Click Clone.

  3. (Optional) In the opened dialog, choose whether you want to attach a new project to the opened one, open a new project in a new window, or close the current project and reuse the existing window.

Open projects

RubyMine lets you open several projects simultaneously in different windows. By default, each time you open a project while another one is opened, RubyMine prompts you to choose whether to open the project in the same window or a new one. If necessary, you can change this behavior later.

Open a project

  1. Click Open on the Welcome screen or select File | Open from the main menu.

  2. In the dialog that opens, select the directory that contains the desired project.

  3. (Optional) In the opened dialog, choose whether you want to attach a project to the opened one, open a project in a new window, or close the current project and reuse the existing window.

    Open the project in the current window, new window, or attach it to the existing project
    • Attach: In this case, a newly opened project shares the window with the already opened project. This can be useful when one project uses another.

    • New Window: If you selected New Window, a new project is opened in its own window. In this case, projects are independent and do not share any information. You can switch between projects using the Window menu.

    • This Window: In this case, RubyMine closes the current project and uses the existing window for a newly opened project.

Switch between open projects

To switch between open projects, you can use the following commands of the Window menu:

  • Window | Next Project Window Ctrl+Alt+]

  • Window | Previous Project Window Ctrl+Alt+[

  • Window | <ProjectNameOrLocation>

Configure the project opening

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Appearance and Behavior | System Settings | Project Opening.

  2. Select one of the following options:
    • Open project in new window: open a new RubyMine window each time a new project is opened.

    • Open project in the same window: stay in the same RubyMine window.

    • Confirm window to open project in: keep the default behavior and display a dialog to choose how to open each new project.

Open multiple projects in one window

RubyMine allows you to work on multiple projects simultaneously. You can open several projects in two ways.

  • In separate windows

    In this case, projects are independent and do not share any information.

  • In one window

    This can be useful when one project uses another.

Attach a new project to the main one

Imagine that one project is already opened and displayed in the Project view.

a project tree with one project

To add another project:

  1. Select File | Open and choose a folder containing the desired project.

  2. In the invoked dialog, click Attach.

    Open the project in the current window, new window, or attach it to the existing project

    RubyMine will show both projects in the Project view.

    a project tree with several projects

Open several projects

When you open a folder containing several subfolders (including nested subfolders), RubyMine detects Gemfiles and displays a message that suggests processing subfolders as Ruby projects.

gemfile warning
  1. Click Configure... and select the projects to be created for each Gemfile found.

    gemfiles without projects
  2. Check Don't ask again to disable automatic Gemfile detection. If necessary, you can enable the Create projects for new Gemfiles option to process folders with new Gemfiles as Ruby projects automatically.

  3. To create a project later manually, right-click a corresponding folder in the Project view and select Mark Directory as | Ruby Project Root. Note that this command is available only for projects containing Gemfiles.

Work with projects in a shared window

  • For all added projects, you can manage Ruby SDK separately on the Ruby SDK and Gems page of the Settings/Preferences dialog Ctrl+Alt+S.

  • When you navigate through the opened projects (for example, Navigate | Class... Ctrl+N), the project name appears to the right.

    navigate to class window
  • You can run commands in the context of the required project by selecting this project in the Project view.

    a project selected in the project tree
  • For each added project, you can manage its structure in the Project Structure page.

Detach a project from a shared window

  • To delete the attached project from the Project view, right-click it and select Remove from Project View Delete.

Reopen recent projects

RubyMine keeps the history list of the recent projects, from which you can select the desired one. When RubyMine starts, the most recent project reopens by default. You can change this behavior on the Settings/Preferences | Appearance & Behavior | System Settings page using the Reopen last project on startup option.

Reopen a recent project

  1. Do one of the following:

    • From the main menu, select File | Open Recent and select the desired project from the list.

    • Press Ctrl and type Open in the invoked popup. Then select the required project from the list and press Enter.

    • On the Welcome screen, click the desired project in the left-hand pane where the list of your recent projects is shown. You can type in the Welcome screen to filter the list of recent projects.

  2. (Optional) In the opened dialog, choose whether you want to attach a new project to the opened one, open a new project in a new window, or close the current project and reuse the existing window.

Remove a project from the list of recent projects

  1. Select File | Open Recent | Manage Projects from the main menu.

  2. Click the closing icon for the project to remove.

    Remove a recent project from the list of the recent projects

    The selected project will be removed from the list of the recent projects and won't appear on the Welcome screen.

Organize projects into groups

RubyMine allows you to organize projects into specified groups. You can create a new group by right-clicking the list of recent projects and selecting New Project Group.

grouping projects

To move a project into a group, right-click this project, select Move to Group, and choose the required group to place the project in.

Close projects

If you need to close only one project, you can either close the project window or select File | Close Project from the main menu.

If you work with multiple projects, use the following actions to close many projects at once:

Close all projects

  • From the main menu, select File | Close All Projects.

    This action closes all projects that are currently opened in RubyMine.

Close all but the current project

  • From the main menu, select File | Close Other Projects.

    This action closes all opened projects except the current one.

Last modified: 11 June 2021