Everyday Rails

Know your Rails command line tools

By Aaron Sumner, July 23, 2010.

In a keynote at last week’s Ruby Midwest conference in Kansas City, Rails core contributor Yehuda Katz talked about the attention the Rails team puts into the experience of the developer. A large part of this experience is the command line, and Yehuda pointed to the efforts that have been put into making sure that interface to Rails and the software you write with it is as useful as possible. The goal is to keep you from having to refer to a manual or stack trace as little as possible.

If Rails is your first real exposure to the command line—and I know a few people for whom this is true—you may think that command lines aren’t what we use to interact with computers anymore (especially on Macs). With a bit of practice, though, you may discover that the command line is a much quicker and more powerful way to get things done on your computer than a graphical interface and a mouse. Here are some resources to get you started with the command line in Rails.

The basics

Generators

Rails has default generators like scaffold, model and the like; various gems and plugins add generators of their own to help you quickly get your applications up and running. See the RailsGuides above for the defaults and the documentation of your installed gems and plugins for what they provide.

For Rails 2.3:

When it comes to generators, everything changes in Rails 3.

Rake

Rake, Ruby’s build tool, is essential to Rails development. Rake is discussed in the RailsGuides referenced above. You’re not limited to the tasks Rails provides—the gems and plugins your app uses may add tasks, and you can create your own.

Unix

These last links aren’t specific to Rails, but a general grasp of the Unix command line is going to make your life as a Rails developer much easier, and can help you get other things done on your computer that are cumbersome (or impossible) via a graphical interface. Seriously, if you’re using a Mac or Linux-based computer, learn the command line.

If you really want to get hands-on exposure to command line-only computing, install Ubuntu Server Edition a computer or virtual machine. This version of Ubuntu Linux is optimized for server use so it doesn’t include a GUI out of the box. You can install one if you want, but you’ll need to use the command line to do so.

What do you think? Follow along on on Twitter or Facebook to let me know what you think and catch my latest posts. Better yet, subscribe to my newsletter for updates from Everyday Rails, book picks, and other thoughts and ideas that didn't quite fit here.

Test with confidence!

If you liked my series on practical advice for adding reliable tests to your Rails apps, check out the expanded ebook version. Lots of additional, exclusive content and a complete sample Rails application.

Newsletter

Ruby on Rails news and tips, and other ideas and surprises from Aaron at Everyday Rails. Delivered to your inbox on no particular set schedule.