RubyMine 2022.2 Help

Tutorial: Debug an application running with Foreman

Foreman is a tool for managing Procfile-based applications. For example, you can run the Rails server alongside with webpack-dev-server to use live reloading:

web: rails server webpacker: ./bin/webpack-dev-server

In this tutorial, we'll show you how to create a separate run/debug configuration for running an application with Foreman, and how to debug this application.

Prerequisites

Before working with Foreman, make sure that the 'foreman' gem is installed in the project SDK.

Create a configuration for running Foreman

First, we need to create a configuration for running or debugging an application that uses Foreman. RubyMine doesn't have a dedicated run configuration for Foreman. We'll use the Gem Command configuration that provides the ability to execute commands of arbitrary gems.

  1. In the main menu, go to Run | Edit Configurations, click the Add icon, and select Gem Command from the list.

  2. In the Run/Debug Configurations dialog, specify the following settings:

    Foreman run/debug configuration
    • Name: Enter the run/debug configuration name, for example, foreman start.

    • Gem name: Specify the foreman gem here.

    • Executable name: Select the foreman executable.

    • Arguments: Specify an argument for running the application using Foreman, for example, start.

    Click OK.

Debug the application

To debug the newly created foreman start configuration, follow the steps below:

  1. Set breakpoints in your application.

  2. Press Ctrl twice and type the configuration name in the invoked Run Anything popup: foreman start.

  3. Press and hold down the Shift key (the dialog title changes to Debug) and press Enter.

  4. Perform the required steps in your application to stop on a breakpoint. RubyMine will suspend the application execution before the breakpoint.

    Stop on a breakpoint
Last modified: 09 August 2022