Skip to content

Commit 345e95f

Browse files
go for the easy way
1 parent 96b1f46 commit 345e95f

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

inst/hooks/exported/pkgdown.R

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,7 @@ if (is.null(pkgdown:::pkgdown_config_path("."))) {
1212
if (!require(pkgdown, quietly = TRUE)) {
1313
stop("{pkgdown} could not be loaded, please install it.")
1414
}
15-
if (!require(mockery, quietly = TRUE)) {
16-
stop("{mockery} could not be loaded, please install it.")
15+
if (packageVersion("pkgdown") < package_version("2.0.4")) {
16+
rlang::abort("You need at least version 2.0.4 of {pkgdown} to run this hook.")
1717
}
18-
19-
stub_render_page <- function(pkg, name, data, ...) {
20-
force(data)
21-
}
22-
stub(build_reference_index, "render_page", stub_render_page)
23-
stub(build_articles_index, "render_page", stub_render_page)
24-
config <- yaml::read_yaml(pkgdown:::pkgdown_config_path("."))
25-
26-
tryCatch(
27-
{
28-
if ("reference" %in% names(config)) {
29-
build_reference_index()
30-
}
31-
if ("articles" %in% names(config)) {
32-
build_articles_index()
33-
}
34-
},
35-
error = function(e) stop(e),
36-
warning = function(w) stop(w)
37-
)
18+
check_pkgdown()

0 commit comments

Comments
 (0)