Skip to content

Commit

Permalink
do not add "docs" inside output_path
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Nov 23, 2024
1 parent 37a673f commit 2b1c7dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions R/render_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#' since the last call to `render_docs()`, that file is skipped. File hashes
#' are stored in `altdoc/freeze.rds`. If that file is deleted, all man pages
#' and vignettes will be rendered anew.
#' @param output_path Destination path for the documentation. For instance,
#' specifying `output_path = "foo"` will write the documentation in `foo/docs`.
#' @param output_path Destination path for the documentation.
#' @param ... Additional arguments are ignored.
#' @inheritParams setup_docs
#' @export
Expand Down Expand Up @@ -120,7 +119,8 @@ render_docs <- function(
.import_settings(path = path, tool = tool, verbose = verbose, freeze = freeze)

if (output_path != path) {
fs::dir_copy(fs::path(path, "docs"), fs::path(output_path, "docs"))
files_to_copy <- list.files(fs::path(path, "docs"), full.names = TRUE)
file.copy(files_to_copy, to = fs::path(output_path), recursive = TRUE)
fs::dir_delete(fs::path(path, "docs"))
}

Expand Down
3 changes: 1 addition & 2 deletions man/render_docs.Rd

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

7 changes: 6 additions & 1 deletion tests/testthat/test-render_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,17 @@ test_that("arg 'output_path' works", {
parent_dir <- withr::local_tempfile()
create_local_package(dir = parent_dir)
fs::dir_create(fs::path("..", "foobar"))
fs::dir_create("man")
install.packages(".", repos = NULL, type = "source")
cat("\\name{hi}\n\\title{hi}\n\\usage{\nhi()\n}\n\\examples{\n1 + 1\n}\n", file = "man/foo.Rd")

setup_docs("docute")
render_docs(output_path = "../foobar", verbose = .on_ci())

expect_false(dir_exists("docs"))
expect_true(dir_exists("../foobar/docs"))
expect_true(dir_exists("../foobar"))
expect_true(file_exists("../foobar/docute.html"))
expect_true(file_exists("../foobar/man/foo.md"))
})


Expand Down

0 comments on commit 2b1c7dc

Please sign in to comment.