Book Image

Rake Task Management Essentials

By : Andrey Koleshko
Book Image

Rake Task Management Essentials

By: Andrey Koleshko

Overview of this book

Table of Contents (18 chapters)
Rake Task Management Essentials
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

The cleaning tasks


At this stage, we need to be introduced to some terms that we should know in order to write clean tasks. To be able to define clean tasks, we have to include the cleaner with the following line of code:

require 'rake/clean'

This defines two constants, CLEAN and CLOBBER, and two tasks, clean and clobber.

  • CLEAN: This is a list of files to be cleaned. The clean task goes though this list and removes them.

  • CLOBBER: This is a list of generated files. These are files that are produced by rake tasks and they are usually the last files in the chain. The clobber task goes through this list and removes these files. This task has one prerequisite: it has to be a clean task.

The idea of using clean tasks is very simple. Just add the necessary files or folders to both these lists and run the appropriate tasks, as shown in the following code snippet (it's up to you to separate the files to clean or clobber). That's it, let's do this:

require 'rake/clean'

FORMATS = [:pdf, :html, :mobi...