Skip to Main Content
Professional Ruby on Rails™
book

Professional Ruby on Rails™

by Noel Rappin
February 2008
Intermediate to advanced content levelIntermediate to advanced
479 pages
14h
English
Wrox
Content preview from Professional Ruby on Rails™

4.1. What Rake Can Do for You

Before talking about how you can write custom Rake tasks to support your project, you should take a look at the variety of Rake tasks that have already been created. These cover a wide variety of tasks, including database support, documentation support, annotation support, and test support. Use the following command line to see a list of defined Rake tasks:

rake -T

The output of this command is a list of the defined Rake tasks with their descriptions as entered in the rakefile.

The following sections describe the tasks in the standard Rails rakefile. There's a good chance that there's a task in here that you didn't know about that will save you time on your projects. Each group of tasks has a table, and any further comments about these tasks are included after the table.

4.1.1. Rake Database Tasks

Most of the Rake tasks defined by Rails concern the database, in part to provide a common command line shortcut for database features that would otherwise take a significant amount of scripting, and which might differ depending on the exact database being used.

The first set of tasks, described in the following table, deals with creating a database or setting it to the current schema. A couple of methods of dumping the schema to a text file are also supported. The colon is the namespace delimiter in Rake, and all the database tasks start with db: .

TaskDescription
db:abort_if_pending_migrationsUsed as a dependent task, stops Rake if there is an unperformed ...
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.
Start your free trial

You might also like

Ruby on Rails® Bible

Ruby on Rails® Bible

Timothy Fisher
Rails 4 in Action

Rails 4 in Action

Yehuda Katz, Rebecca Skinner, Stephen Klabnik, Ryan Bigg

Publisher Resources

ISBN: 9780470223888Purchase book