Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(is_drake_project)
export(is_git_root)
export(is_pkgdown_project)
export(is_projectile_project)
export(is_quarto_project)
export(is_r_package)
export(is_remake_project)
export(is_root_criterion)
Expand Down
12 changes: 12 additions & 0 deletions R/root.R
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ is_pkgdown_project <- has_file("_pkgdown.yml") | has_file("_pkgdown.yaml") | has
#' @export
is_projectile_project <- has_file(".projectile")

#' @export
is_quarto_project <- has_file("_quarto.yml")

#' @export
is_git_root <- has_dir(".git") | has_file(".git", contents = "^gitdir: ")

Expand Down Expand Up @@ -353,6 +356,7 @@ criteria <- structure(
is_remake_project = is_remake_project,
is_pkgdown_project = is_pkgdown_project,
is_projectile_project = is_projectile_project,
is_quarto_project = is_quarto_project,
is_git_root = is_git_root,
is_svn_root = is_svn_root,
is_vcs_root = is_vcs_root,
Expand Down Expand Up @@ -416,6 +420,14 @@ str.root_criteria <- function(object, ...) {
#' @export
"is_projectile_project"

#' @details
#' `is_quarto_project` looks for a `_quarto.yml` file.
#'
#' @format NULL
#' @rdname criteria
#' @export
"is_quarto_project"

#' @details
#' `is_git_root` looks for a `.git` directory.
#'
Expand Down
5 changes: 5 additions & 0 deletions man/criteria.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion tests/testthat/_snaps/root.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
$is_projectile_project
Root criterion: contains a file ".projectile"

$is_quarto_project
Root criterion: contains a file "_quarto.yml"

$is_git_root
Root criterion: one of
- contains a directory ".git"
Expand Down Expand Up @@ -88,12 +91,13 @@
Code
str(criteria)
Output
List of 10
List of 11
$ is_rstudio_project : chr "Root criterion: contains a file matching \"[.]Rproj$\" with contents matching \"^Version: \" in the first line"
$ is_r_package : chr "Root criterion: contains a file \"DESCRIPTION\" with contents matching \"^Package: \""
$ is_remake_project : chr "Root criterion: contains a file \"remake.yml\""
$ is_pkgdown_project : chr [1:5] "Root criterion: one of" "- contains a file \"_pkgdown.yml\"" "- contains a file \"_pkgdown.yaml\"" "- contains a file \"pkgdown/_pkgdown.yml\"" ...
$ is_projectile_project: chr "Root criterion: contains a file \".projectile\""
$ is_quarto_project : chr "Root criterion: contains a file \"_quarto.yml\""
$ is_git_root : chr [1:3] "Root criterion: one of" "- contains a directory \".git\"" "- contains a file \".git\" with contents matching \"^gitdir: \""
$ is_svn_root : chr "Root criterion: contains a directory \".svn\""
$ is_vcs_root : chr [1:4] "Root criterion: one of" "- contains a directory \".git\"" "- contains a file \".git\" with contents matching \"^gitdir: \"" "- contains a directory \".svn\""
Expand Down