Skip to content

Commit 43bce71

Browse files
authored
Merge pull request #79 from salim-b/add-is-pkgdown
- Add `is_pkgdown_project` root criterion looking for a `_pkgdown.yml`, `_pkgdown.yaml`, `pkgdown/_pkgdown.yml` and/or `inst/_pkgdown.yml` file (#79, @salim-b).
2 parents 7adc4de + cfd34b9 commit 43bce71

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export(has_file_pattern)
2525
export(is.root_criterion)
2626
export(is_drake_project)
2727
export(is_git_root)
28+
export(is_pkgdown_project)
2829
export(is_projectile_project)
2930
export(is_r_package)
3031
export(is_remake_project)

NEWS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# rprojroot 2.0.2.9000 (2020-11-15)
1+
# rprojroot 2.0.2.9000 (2021-02-23)
22

3-
- Internal changes only.
3+
## Features
4+
5+
- Add `is_pkgdown_project` root criterion looking for a `_pkgdown.yml`, `_pkgdown.yaml`, `pkgdown/_pkgdown.yml` and/or `inst/_pkgdown.yml` file
46

57

68
# rprojroot 2.0.2 (2020-11-15)

R/root.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ is_remake_project <- has_file("remake.yml")
318318
#' @export
319319
is_drake_project <- has_dir(".drake")
320320

321+
#' @export
322+
is_pkgdown_project <- has_file("_pkgdown.yml") | has_file("_pkgdown.yaml") | has_file("pkgdown/_pkgdown.yml") | has_file("inst/_pkgdown.yml")
323+
321324
#' @export
322325
is_projectile_project <- has_file(".projectile")
323326

@@ -348,6 +351,7 @@ criteria <- structure(
348351
is_rstudio_project = is_rstudio_project,
349352
is_r_package = is_r_package,
350353
is_remake_project = is_remake_project,
354+
is_pkgdown_project = is_pkgdown_project,
351355
is_projectile_project = is_projectile_project,
352356
is_git_root = is_git_root,
353357
is_svn_root = is_svn_root,
@@ -396,6 +400,14 @@ str.root_criteria <- function(object, ...) {
396400
#' @export
397401
"is_drake_project"
398402

403+
#' @details
404+
#' `is_pkgdown_project` looks for a `_pkgdown.yml`, `_pkgdown.yaml`, `pkgdown/_pkgdown.yml` and/or `inst/_pkgdown.yml` file.
405+
#'
406+
#' @format NULL
407+
#' @rdname criteria
408+
#' @export
409+
"is_pkgdown_project"
410+
399411
#' @details
400412
#' `is_projectile_project` looks for a `.projectile` file.
401413
#'

man/criteria.Rd

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/root.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@
5050
$is_remake_project
5151
Root criterion: contains a file "remake.yml"
5252
53+
$is_pkgdown_project
54+
Root criterion: one of
55+
- contains a file "_pkgdown.yml"
56+
- contains a file "_pkgdown.yaml"
57+
- contains a file "pkgdown/_pkgdown.yml"
58+
- contains a file "inst/_pkgdown.yml"
59+
5360
$is_projectile_project
5461
Root criterion: contains a file ".projectile"
5562
@@ -81,10 +88,11 @@
8188
Code
8289
str(criteria)
8390
Output
84-
List of 9
91+
List of 10
8592
$ is_rstudio_project : chr "Root criterion: contains a file matching \"[.]Rproj$\" with contents matching \"^Version: \" in the first line"
8693
$ is_r_package : chr "Root criterion: contains a file \"DESCRIPTION\" with contents matching \"^Package: \""
8794
$ is_remake_project : chr "Root criterion: contains a file \"remake.yml\""
95+
$ 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\"" ...
8896
$ is_projectile_project: chr "Root criterion: contains a file \".projectile\""
8997
$ is_git_root : chr [1:3] "Root criterion: one of" "- contains a directory \".git\"" "- contains a file \".git\" with contents matching \"^gitdir: \""
9098
$ is_svn_root : chr "Root criterion: contains a directory \".svn\""

0 commit comments

Comments
 (0)