Automate Frequent Tasks

Overview

Teaching: 10 min
Exercises: 10 min
Questions
  • How should I handle tasks I do repeatedly?

Objectives
  • Explain what build managers were originally designed to do, and what else they are now used to do.

  • Make a build file self-explaining.

  • Explain when to use checklists rather than a build manager.

DRY: Don’t Repeat Yourself

Build Manager

Checklists

How Do You Manage Your Repository?

Describe in 3-4 bullet points how you actually manage your version control repository. How often are you working on several things simultaneously?

Create a Task list

  1. If your project already uses a build manager, what tasks are used most often?
  2. If your project doesn’t use a build manager, what are the first few tasks you should automate?

Self-Documenting Build Files

The default target in a build file (e.g., make with no parameters) should print a list of available commands. Look at the Makefile in this repository to see how this works, then modify the build file for your project to do so as well.

Create a Setup Checklist

  1. Write a short point-form checklist describing the things you do when setting up a new machine to do development on your project.

  2. How many of the steps in your checklist can be automated using shell scripts or other small programs?

  3. How will newcomers know if they have completed the steps in the checklist correctly?

Key Points

  • Use a build manager to manage repetitive tasks.

  • Make build files explain themselves.

  • Use checklists for tasks that have to be done repeatedly, but can’t be done by a computer.

  • Have new contributors go through checklists to look for omissions and inaccuracies.