RubyMine provides different ways to run scripts and applications, rake tasks, rails generators, and so on. You can run all of these actions using shortcuts, menu commands or a terminal. RubyMine allows you to use a single entry point for various operations - Run anything:
Invoke the Run Anything Dialog
To invoke the Run anything dialog, do one of the following:
- Double-press Ctrl.
- Click the button in the toolbar.
- Press Ctrl+Shift+A, type Run anything and press Enter.
In this dialog, you can perform the following actions:
- Run/debug an application for the selected run/debug configuration.
- Run Ruby/Rails-specific commands (Rails generators, Bundler commands, Rake tasks, etc.).
- Run commands in the current context.
- Open recent projects.
Type a question mark to see hints for the available commands:
You can also start typing the query to see the available commands and run/debug configurations:
Use the button to configure action groups used for search.
Running/Debugging an Application
To debug an application, hold down the Shift key when running a run/debug configuration (the dialog title will be changed to Debug):
Running Ruby/Rails-Specific Commands
Run anything allows you to execute various Ruby- or Rails-specific commands, for instance:
- Ruby scripts
- Tests (Test::Unit, Rspec, Cucumber, etc.)
- Rails generators
- Rake tasks
- Bundler commands
- Capistrano commands
- Rack commands
You can also run Rails and IRB consoles, or change the project SDK using commands dependent on the utilized version manager (RVM, rbenv, etc).
Run anything executes commands in the following way:
First, if offers a list of predefined actions that include available Bundler commands, Rake tasks, Rails generators, etc.:
If the specified command is not found in the predefined actions, Run anything tries to match this command to any default run configuration. Below are few examples:
Running the ruby interpreter for a specific script:
Running the Rspec test:
Deploying an application using Capistrano:
You can see that the icon next to the specified command identifies the corresponding run configuration. After running this command, RubyMine adds this configuration to temporary configurations.
If the specified command does not match to any predefined action or a default configuration, RubyMine runs this command in a terminal. For instance, this can be any standard command-line utility (such telnet, ssh, pwd):
Running Commands in the Current Context
Any command launched using Run anything is run in a context of the current project root directory. If necessary, you can run commands in the current context, which can be determined by a project or folder selected in the project tree, a project file currently opened in the editor and has focus, etc.
To launch a command in the current context, hold down the Alt key before running the command (the dialog title will be changed to Run in Context):
This functionality can be useful for launching scratch files because they are placed outside of the project’s root folder.
Opening Recent Projects
The Run anything dialog allows you to reopen recent projects. To do this, type the open command, select the required project in the list and press Enter: