forked from r-lib/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-site.R
30 lines (27 loc) · 819 Bytes
/
build-site.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#' Execute \pkg{pkgdown} build_site in a package
#'
#' `build_site()` is a shortcut for [pkgdown::build_site()], it generates the
#' static HTML documentation.
#'
#' @param path path to the package to build the static HTML.
#' @param ... additional arguments passed to [pkgdown::build_site()]
#' @inheritParams install
#'
#' @return NULL
#' @export
build_site <- function(path = ".", quiet = TRUE, ...) {
check_suggested("pkgdown")
save_all()
pkg <- as.package(path)
withr::with_temp_libpaths(action = "prefix", code = {
install(pkg = pkg$path, upgrade = "never", reload = FALSE, quiet = quiet)
if (isTRUE(quiet)) {
withr::with_output_sink(
tempfile(),
pkgdown::build_site(pkg = pkg$path, ...)
)
} else {
pkgdown::build_site(pkg = pkg$path, ...)
}
})
}