RubyMine 2020.1 Help

Run/debug configurations

RubyMine provides the capability to run and debug Ruby and Rails applications, run tests, and deploy your code in a universal way - by using run/debug configurations. Run/debug configurations provide the default set of startup parameters that allow you to run the desired command quickly. You can customize these parameters according to your requirements, for example:

  • For the Rails run/debug configuration, you can specify a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on.

  • For the Ruby run/debug configuration, you can define command-line arguments, pass the required environment variables, and so on.

  • For RSpec, you can choose a folder containing the required tests and provide custom runner options.

Let's see on how to work with run/debug configurations in general - from creating a temporary configuration to sharing configurations through VCS.

Create configurations

RubyMine provides the following ways to create a run/debug configuration:

Create a configuration manually

  1. Open the Run/Debug Configuration dialog in one of the following ways:

    • Select Run | Edit Configurations from the main menu.

    • With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.

      Edit run configurations

    • Press Shift+Alt+F10, then press 0 or select the configuration from the popup and press F4.

  2. In the Run/Debug Configuration dialog, click Add on the toolbar or press Alt+Insert. Select the desired configuration type from the list.

    New run/debug configuration
  3. For a new run/debug configuration, specify the following settings:

    Run/Debug Configurations: Rails
    • Name: specifies the configuration name.

    • Allow parallel run: If this option is enabled, you can launch a run configuration multiple times in parallel instead of rerunning it. Each runner will start in its own tab of the Run or Debug tool window.

    • Store as project file: Enable this option to save your configuration as a project file and share it with team members through VCS.

    • Configure settings specific for the selected configuration type (for example, Ruby, Rails, or RSpec).

    • Before Launch: In this area, you can specify tasks that must be performed before running a configuration.

    • Show this page: Enable this option to show the run/debug configuration settings prior to actually starting it.

    • Activate tool window: Use this option to specify whether or not the Run/Debug tool window opens when you start the run/debug configuration.

  4. Apply the changes and close the dialog.

Temporary configurations

When you run a Ruby script, Rails server, test, or another command, RubyMine automatically creates a corresponding temporary run configuration. Such configurations are greyed out in the list of the available configurations.

Save a temporary configuration

  • In the Run/Debug Configuration selector, choose Save <configuration name>.

    Edit run configurations
  • In the Edit Configurations dialog, select the temporary configuration in the list, and click Save button.

Configure a limit of temporary configurations

By default, there can be created only five temporary configurations per project, so when you create the sixth configuration, the one created first gets removed, and so on. To change this limit:

  1. Open the Edit Configurations dialog and go to Edit Configurations | Templates.

  2. Specify the desired value using the Temporary configurations limit option.

Compound configurations

Suppose you would like to launch multiple run/debug configurations simultaneously. For example, you may want to run the sequence of several test configurations or run several configurations of different types. You can configure this behavior with a compound run/debug configuration.

Create a compound run/debug configuration

  1. Open the Run/Debug configurations dialog as described in Create a configuration manually.

  2. In the Run/Debug Configuration dialog, click Add on the toolbar or press Alt+Insert. Select the Compound configuration from the list.

  3. To include the existing run/debug configuration into the compound configuration, click Add and select the desired one from the list.

  4. Apply the changes and close the dialog.

Before launch tasks

When you are creating or editing a configuration, you can specify tasks that must be performed before running a configuration using the Before Launch. For example, you can run the db:prepare Rake task before running a test configuration.

To add a task, click the Add button and select the desired task.

List of tasks

  • Run External tool: select to run an external application. In the dialog that opens, select one or multiple applications you want to run. If it is not defined in RubyMine yet, add its definition. For more information, see External tools.

  • Run Another Configuration: select to execute another run/debug configuration. In the dialog that opens, select the configuration to be run.

  • Launch Web Browser: open the specified URL in a browser.

  • Run Grunt task: select this option to run a Grunt task.

  • Run Gulp task: select this option to run a Gulp task.

  • Run npm Script: select this option to execute an npm script.

  • Compile TypeScript: select to run the built-in TypeScript compiler and thus make sure that all the changes you made to your TypeScript code are reflected in the generated JavaScript files. In the TypeScript Compile Settings dialog that opens, select or clear the Check errors checkbox to configure the behaviour of the compiler in case any errors are detected:

    • If the Check errors checkbox is selected, the compiler will show all the errors and the run configuration will not start.

    • If the Check errors checkbox is cleared, the compiler will show all the detected errors but the run configuration still will be launched.

  • Generate CoffeeScript Source Maps: select this option to generate the source maps for your CoffeeScript sources. In the dialog that opens, specify where your CoffeeScript source files are located

  • Run Remote External tool: add a remote SSH external tool.

  • Run Shell Script: allows you to run a specified shell script. Note that you need to create the Shell Script configuration for this.

  • Run Rake task: add a Rake task to be executed prior to running or debugging.

  • Run JRuby compiler: choose this option to execute JRuby compiler with the specified target path, compiler process heap size, and command line parameters (if any).

Change configuration templates

For a run/debug configuration of a particular type, you can set up the default values for one or more parameters and save them as a template for further usage. In this case, the next time when you create a new configuration of that type, the corresponding fields of the dialog will already contain the specified values.

Set up the default values for a run/debug configuration

  1. In the left-hand pane of the Run/Debug Configurations dialog, expand the Templates node.

  2. Select the desired configuration type under the Templates node. The corresponding configuration template appears in the right-hand pane.

  3. Specify the desired parameters in the right pane and click Apply to save the template.

    run/debug templates

Group configurations in folders

When there are too many run/debug configurations of the same type, you can group them in folders, so they become easier to distinguish visually.

folders for run configurations

Create a folder for run/debug configurations

  1. Open the Run/Debug configurations dialog as described in Create a configuration manually.

  2. In the Run/Debug Configuration dialog, click the New Folder icon on the toolbar. A new empty folder is created.

  3. Specify the folder name in the text field to the right, or accept the default name.

  4. Select the desired run/debug configuration of a certain type, and move under the target folder. This can be done in one of the following ways:

    • Drag the selected configuration.

    • Use the Move up button and Move down button toolbar buttons.

    • Press Alt+Up or Alt+Down.

  5. Apply changes. Note that if a folder is empty, it will not be saved.

Share configurations

RubyMine allows you to share your configurations with team members through VCS. To do this, perform the following steps:

  1. Open the Run/Debug configurations dialog as described in Create a configuration manually.

  2. In the Run/Debug Configuration dialog, select the required configuration and enable the Store as project file option. RubyMine suggests you to create a file containing configuration settings in the .idea/runConfigurations directory.

  3. (Optional) If the .idea directory is added to VCS ignored files, the .idea/runConfigurations subfolder will be ignored, too. If you use Git for your project, you can share .idea/runConfigurations only and leave .idea ignored by modifying .gitignore as follows:

    /.idea/* !/.idea/runConfigurations
Last modified: 29 May 2020