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
LIBDIRin 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