root_criterion
class decide if a
given directory is a project root.
root_criterion(testfun, desc)
is.root_criterion(x)
as.root_criterion(x)
"as.root_criterion"(x)
"as.root_criterion"(x)
has_file(filepath, contents = NULL, n = -1L)
has_file_pattern(pattern, contents = NULL, n = -1L)
TRUE
if the directory specified by this parameter is the project root,
and FALSE
otherwiseroot_criterion
in a very general fashion
by specifying a function with a path
argument, and a description.The as.root_criterion
function accepts objects of class
root_criterion
, and character values; the latter will be
converted to criteria using has_file
.
The has_file
function constructs a criterion that checks for the
existence of a specific file (which itself can be in a subdirectory of the
root) with specific contents.
The has_file_pattern
function constructs a criterion that checks for the
existence of a file that matches a pattern, with specific contents.