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
About the Author
About the Reviewers

Using a regular expression to match more tasks

It's possible to pass a regular expression as a rule pattern in the rule definition. The following example shows you how to do it:

rule /\.html$/ => '.md' do |t|
  sh "pandoc -s #{t.source} -o #{}"

We used the new method in the preceding example, source, which is called on the task. Its name explicitly says what it does—it returns the name of the source. In our case, this is the Markdown file.