Skip to contents

This takes in a vector of files and compares them against a text database of files with checksums. It's been heavily adapted from blogdown to provide utilities for removal and updating of the old database.

Usage

build_status(
  sources,
  db = "site/built/md5sum.txt",
  rebuild = FALSE,
  write = FALSE
)

Arguments

sources

a character vector of ALL source files OR a single file to be rebuilt. These must be absolute paths

db

the path to the database

rebuild

if the files should be rebuilt, set this to TRUE (defaults to FALSE)

write

if TRUE, the database will be updated, Defaults to FALSE, meaning that the database will remain the same.

Value

a list of the following elements

  • build absolute paths of files to build

  • new a new data frame with three columns:

    • file the relative path to the source file

    • checksum the md5 sum of the source file

    • built the relative path to the built file

  • remove absolute paths of files to remove. This will be missing if there is nothing to remove

  • old old database (for debugging). This will be missing if there is no old database or if a single file was rebuilt.

Details

If you supply a single file into this function, we assume that you want that one file to be rebuilt, so we will always return that file in the $build element and update the md5 sum in the database (if it has changed at all).

If you supply multiple files, you are indicating that these are the only files you care about and the database will be updated accordingly, removing entries missing from the sources.