Chapter 4. Build Tools and Automation

Automation is critically important to the success of an ongoing project. As the project continues, you will accumulate task after task — things that need to be done over and over again to keep the project running smoothly. These include cleanup tasks to remove unneeded files or database entries. Depending on the project, you may have to build tasks for compiling or interpreting files in advance. You'll have deployment tasks, to move your program from the development environments to your production servers.

These tasks need to be done repeatedly and they need to be done accurately, which makes them prime targets for automation. And so, for decades, programmers have defined repetitive tasks in various kinds of make files, named, of course, after the original Unix make program — the granddaddy of all programs used to define build tasks.

The key element of a make-like system is the capability to define tasks as being dependent on other tasks. For example, a testing task might depend on a database setup task running first. Or a deployment task might depend on a clean rebuild of the entire project completed successfully before deployment can begin. The complexity of a make system comes not just from defining the tasks themselves, but also from defining the dependency relationships between tasks.

The classic make application is often considered to have a difficult-to-read syntax, and is still most widely used within Unix and C development worlds. ...

Get Professional Ruby on Rails™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.