RubyMine allows you to run or debug entire Rails applications or specific Ruby scripts. The universal way to do this is using configured sets of startup parameters - run/debug configurations. For instance, you can specify the following parameters for the Rails run/debug configuration: a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on.
Run/debug configurations can be created in various ways, for example:
For Rails projects, RubyMine automatically creates the development and production run/debug configurations with the corresponding Rails environments.
For any project, you can create run/debug configurations manually from the predefined templates.
Learn more at Creating and Editing Run/Debug Configurations.
Run an application using a specific run/debug configuration
Use one of the following ways to run a program with a specified Run/Debug configuration:
Press Ctrl twice to invoke the Run Anything popup. Start typing the required configuration name, select it from the list, and press Enter.
Click the button on the toolbar to run the currently selected run/debug configuration.
Select theShift+F10 command from the main menu and select the required configuration.
Run a Ruby script
To run a specified ruby script (for example, script.rb), do one of the following:
Press Ctrl twice to invoke the Run Anything popup, type the ruby script.rb command and press Enter.
Right-click a script in the editor or project tool window, and select Run 'script'.
The actions above create the temporary run configuration that can be changed and saved. You can also run a Ruby script by creating a run configuration manually and running this configuration as described in Run an application using a specific run/debug configuration.
Configure and run the Rails server
For Rails projects, RubyMine automatically creates the development and production run/debug configurations with corresponding Rails environments. For each configuration, you can specify a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on. The procedures below show how to configure and run the Rails server.
Change the Rails run configuration
Press Ctrl+Shift+A and start typing Edit Configurations. Select Edit Configurations and press Enter.
In the invoked Run/Debug Configurations dialog, select the required configuration and specify its settings.
Server - Specifies a web server for running an application. You might need to install a corresponding gem to the project SDK (for example, the passenger gem for the Passenger server).
Environment - Allows you to select the Rails environment.
Run browser - Enables opening an application automatically in a default browser.
Run the Rails server
Press Ctrl twice.
Start typing the required configuration name, select it from the list, and press Enter.
Wait until RubyMine starts the Rails server. The Run tool window shows the application's output.
Rerun an application
To rerun the launched application, do the following:
In the Run tool window, select the tab where the desired application is opened.
In the toolbar of the Run tool window, click the button Ctrl+F5.
Stop or pause an application
In the Run tool window, you can stop a program or pause its output. If a program is stopped, its process is interrupted and exits immediately. When program output is paused, the program continues running in the background, but its output is suspended.
Stop an application
In the Run tool window, click the button on the toolbar or press Ctrl+F2.
To close the active tab, click the button, or press Ctrl+Shift+F4.
Suspend application output
In the Run tool window, click the button on the toolbar.
View running processes
To preview a list of the launched applications, select Run | Show Running List from the main menu. All active applications will be displayed in a popup placed in the top-right corner of the IDE.
You can click the running process to open the corresponding Run tool window.