Using Rake's file utilities
Rake provides us with a few helpful modules and methods. They may be very useful in some cases, especially while working with files. Knowing them might help you keep Rakefiles
clean and precise. The following is a list of these features:
The
FileList
moduleThe
FileUtils
moduleThe
pathmap
method
The next three sections will explore them in detail.
Using the FileList module functionality to collect the files
There is only one thing remaining in our Rakefile
that would be great to get rid of. Currently, there is a need to change the list of articles manually. Luckily, Rake provides us with a tool to solve this problem—Rake::FileList
. It provides agile instruments to tune your own list of files to be generated. It is flexible enough to filter the list of files by the category of your choice. It also enables you to filter out temp files that are generated by your editor, folders that have to be ignored, and files with some features that can be detected dynamically (timestamps...