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.
railswhen setting up your application, and changes to the contents of the
script/directory in a Rails application.
Rails has default generators like
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, 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.
rake -Tto view the tasks you have access to within your application.
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.
I stand with the Black community against systemic racism, police violence and brutality, intolerance, and hate in the United States and worldwide. We must all demand better from our leaders, and ourselves. Stop tolerating intolerance.
While you're here, please consider making a donation to Black Girls CODE, who do great, important work to provide opportunity to underprivileged girls interested in tech, or any organization working toward equity and safety for all, not just the privileged. Thank you.
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.
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.