Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Running Programs in RubyMine

A typical Rails development environment includes an editor, a terminal for running a web server, and a utility terminal for managing files, using version control, running tests, etc. During development, you’re constantly switching between your editor and these external terminals. RubyMine, an Integrated Development Environment, can eliminate this tedious back and forth workflow. In this post, we’ll learn how to run programs in RubyMine on OS X; allowing you to stay in RubyMine all day long.

Running Files

To run a file, open the file in the editor or select the file in the project tool window, then press control + shift + R. Rerun a file with control + R.

These commands are commonly used to run test files, but they could also be used to run a simple Ruby script.

Run Tool Window

All running programs are displayed in the Run tool window. Press command + 4 to open the Run tool window.

run tool window

Stop a running program with command + F2. Use command + shift + [ and command + shift + ] to navigate between multiple running programs.

Running Tests

In a test file, press control + shift + R outside of any individual test to run all the tests in the file. Press control + shift + R within an individual test to run just that test.

Run Dialog

Open the run dialog with control + alt/option + R. The run dialog lists recently run programs. This is useful for when you want to rerun a test you ran several tests ago.

run dialog

By default, this dialog also includes commands to run a development server, and your entire test suite.

Ruby/Rails Quick List

Use command + option + R to open the Ruby/Rails quick list. The Ruby/Rails quick list includes several useful commands such as, starting a Rails console, and starting an IRB session.

Ruby Rails quick list

You can run a file or a code selection in an existing IRB or Rails console with alt/option + shift + L. View IRB history with command + E.

IRB history

Running Rake Tasks

Run a Rake task with alt/option + R.

run Rake task

If a custom Rake task doesn’t appear in the list, reload Rake tasks from this dialog or the Ruby/Rails quick list (command + alt/option + R).

Running Rails Generators

Run a Rails generator with command + alt/option + G.

run Rails generator

If a custom Rails generator task doesn’t appear in the list, reload Rails generators from this dialog or the Ruby/Rails quick list (command + alt/option + R).

Take Advantage of Your IDE

IDEs increase your productivity by combining all of your development tools into one program. Frequent context switching to external tools not only slows you down, but also requires more in-depth knowledge of each tool. Try gradually replacing external tools with their IDE equivalents. Over time, your knowledge of shell command options and obscure Git commands will no longer seem very important to you.

Comments
  1. Jared Carroll says:

    Great points Chad.

    I agree about basic command-line skills, but defining that competency level is
    difficult. Cloud environments, such as Heroku, have really lowered the bar when
    it comes to putting out production fires. Perhaps it’s best to have someone
    else dedicated to keeping the site up.

    Since moving to RubyMine, I find myself rarely doing any basic command-line
    file management e.g., creating, moving, copying, renaming, or deleting files. I also no
    longer use grep or ack, because RubyMine’s searching is much more accurate and
    powerful. These commands are so basic that I would rather have a smarter, less error-prone tool do them.

    I’m a long-time Git command-line user myself, but I’ve moved almost
    entirely to RubyMine. Searching seems like it would be faster from the
    command-line, however I don’t often search the entire history. I find it
    unusual that you do some of the most basic Git commands from the shell. With the
    exception of interactive rebasing, you should try to experiment with their
    RubyMine equivalents; they’re not that bad.

    RubyMine’s abstractions can also be useful to developers who use multiple OSes.

    Long-time IDE usage definitely could result in forgetting some lower-level skills. I
    think it’s up to the developer to decide how important those skills are.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *