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

Chapter 3. Working with Rules

In the previous chapter, we saw how to work with files. This knowledge will be enough for you to manage any task with files that you might have. However, sometimes, the code will look messy and you will find it inconvenient. So, the goal of this chapter is to improve the code and get rid of duplication in a task's actions. The chapter covers a technique to get rid of duplication of code in a task's body with the help of rules. The rules allow us to specify the templates with which we can catch a lot of task names and evaluate corresponding actions. This feature might help in many situations while writing a Rake project.

In this chapter, we will cover the following topics:

  • Understanding the duplication of the file tasks

  • Using a rule to get rid of the duplicated file tasks

  • Detecting a source for the rule dynamically

  • Using a regular expression to match more tasks