Skip to Content
Ruby Pocket Reference
book

Ruby Pocket Reference

by Michael Fitzgerald
July 2007
Beginner to intermediate
176 pages
2h 30m
English
O'Reilly Media, Inc.
Content preview from Ruby Pocket Reference

Rake

A build tool helps you build, compile, or otherwise process files, sometimes large numbers of them. Rake is a build tool like make (http://www.gnu.org/software/make) and Apache ant (http://ant.apache.org), but it is written in Ruby. It is used by Ruby many applications, not just Rails. Rails operations use Rake frequently, so it is worth mentioning here.

Rake uses a Rakefile to figure out what to do. A Rakefile contains named tasks. When you create a Rails project, a Rakefile is automatically created to help you deal with a variety of jobs, such as running tests and looking at project statistics. (After creating a Rails project with one of the tutorials below, while in the main Rails project directory, run rake --tasks or rails stats to get a flavor of what Rake does.)

Rake was written by Jim Weirich (http://onestepback.org). You’ll find documentation on Rake at http://rake.rubyforge.org. Additionally, you’ll find a good introduction to Rake, by Martin Fowler, at http://www.martinfowler.com/articles/rake.html.

Check to see whether Rake is present:

$ rake --version
rake, version 0.7.2

If this command fails, use RubyGems to install Rake, as shown in the previous section.

To run Rake help, type:

$ rake --help

Usage:

rake [-f rakefile] {options} targets...

Options:

--classic-namespace (-C)

Put Task and FileTask in the top-level namespace.

--dry-run (-n)

Do a dry run without executing actions.

--help (-H)

Display this help message.

--libdir=LIBDIR (-I)

Include LIBDIR in the search path for required ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ruby Pocket Reference, 2nd Edition

Ruby Pocket Reference, 2nd Edition

Michael Fitzgerald
Ruby Phrasebook

Ruby Phrasebook

Jason Clinton
Ruby by Example

Ruby by Example

Kevin C. Baird

Publisher Resources

ISBN: 9780596514815Errata Page