|
| 1 | +% Generated by roxygen2 (4.1.1.9001): do not edit by hand |
| 2 | +% Please edit documentation in R/criterion.R, R/has-file.R |
| 3 | +\name{root_criterion} |
| 4 | +\alias{as.root_criterion} |
| 5 | +\alias{as.root_criterion.character} |
| 6 | +\alias{as.root_criterion.root_criterion} |
| 7 | +\alias{has_file} |
| 8 | +\alias{has_file_pattern} |
| 9 | +\alias{is.root_criterion} |
| 10 | +\alias{root_criterion} |
| 11 | +\title{Is a directory the project root?} |
| 12 | +\usage{ |
| 13 | +root_criterion(testfun, desc) |
| 14 | + |
| 15 | +is.root_criterion(x) |
| 16 | + |
| 17 | +as.root_criterion(x) |
| 18 | + |
| 19 | +\method{as.root_criterion}{character}(x) |
| 20 | + |
| 21 | +\method{as.root_criterion}{root_criterion}(x) |
| 22 | + |
| 23 | +has_file(filepath, contents = NULL, n = -1L) |
| 24 | + |
| 25 | +has_file_pattern(pattern, contents = NULL, n = -1L) |
| 26 | +} |
| 27 | +\arguments{ |
| 28 | +\item{testfun}{A function with one parameter that returns \code{TRUE} |
| 29 | +if the directory specified by this parameter is the project root, |
| 30 | +and \code{FALSE} otherwise} |
| 31 | + |
| 32 | +\item{desc}{A textual description of the test criterion} |
| 33 | + |
| 34 | +\item{x}{An object} |
| 35 | + |
| 36 | +\item{filepath}{File path (can contain directories)} |
| 37 | + |
| 38 | +\item{contents}{Regular expression to match the file contents} |
| 39 | + |
| 40 | +\item{n}{integer. The (maximal) number of lines to |
| 41 | + read. Negative values indicate that one should read up to the end of |
| 42 | + input on the connection.} |
| 43 | + |
| 44 | +\item{pattern}{Regular expression to match the file name} |
| 45 | +} |
| 46 | +\description{ |
| 47 | +Objects of the \code{root_criterion} class decide if a |
| 48 | +given directory is a project root. |
| 49 | +} |
| 50 | +\details{ |
| 51 | +Construct criteria using \code{root_criterion} in a very general fashion |
| 52 | +by specifying a function with a \code{path} argument, and a description. |
| 53 | + |
| 54 | +The \code{as.root_criterion} function accepts objects of class |
| 55 | +\code{root_criterion}, and character values; the latter will be |
| 56 | +converted to criteria using \code{has_file}. |
| 57 | + |
| 58 | +The \code{has_file} function constructs a criterion that checks for the |
| 59 | +existence of a specific file (which itself can be in a subdirectory of the |
| 60 | +root) with specific contents. |
| 61 | + |
| 62 | +The \code{has_file_pattern} function constructs a criterion that checks for the |
| 63 | +existence of a file that matches a pattern, with specific contents. |
| 64 | +} |
| 65 | + |
0 commit comments