From 1939848ba8d32d75838bde6d7c4d724a838db63f Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:26:38 +0100 Subject: [PATCH 1/8] init --- R/utils.R | 28 +++++---- .../examples/testpkg.altdoc.noURL/DESCRIPTION | 15 +++++ .../examples/testpkg.altdoc.noURL/NAMESPACE | 7 +++ .../examples/testpkg.altdoc.noURL/NEWS.md | 9 +++ .../testpkg.altdoc.noURL/R/examplesIf_false.R | 12 ++++ .../testpkg.altdoc.noURL/R/examplesIf_true.R | 12 ++++ .../testpkg.altdoc.noURL/R/hello_base.R | 28 +++++++++ .../testpkg.altdoc.noURL/R/hello_r6.R | 30 +++++++++ .../examples/testpkg.altdoc.noURL/README.Rmd | 41 ++++++++++++ .../examples/testpkg.altdoc.noURL/README.md | 36 +++++++++++ tests/testthat/test-render_docs.R | 63 ++++++++++++++----- 11 files changed, 254 insertions(+), 27 deletions(-) create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/DESCRIPTION create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/NAMESPACE create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/NEWS.md create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/README.Rmd create mode 100644 tests/testthat/examples/testpkg.altdoc.noURL/README.md diff --git a/R/utils.R b/R/utils.R index 5e9543a1..8c388f70 100644 --- a/R/utils.R +++ b/R/utils.R @@ -44,7 +44,7 @@ ) if (length(.gh_urls) == 0) { - return("") + return(NULL) } .gh_url <- .gh_urls[grep("github.com", .gh_urls)] @@ -58,11 +58,9 @@ .gh_url <- gsub("#.*", "", .gh_url) .gh_url <- unique(.gh_url) - if (length(.gh_url) == 0) .gh_url <- "" return(.gh_url) } - # Get the tool that was used .doc_type <- function(path = ".") { fn <- fs::path_join(c(path, "altdoc", "mkdocs.yml")) @@ -97,7 +95,6 @@ return(NULL) } - # Get the path for files .doc_path <- function(path = ".") { return(fs::path_abs("docs", start = path)) @@ -121,15 +118,16 @@ as.character(utils::packageVersion("altdoc")) } - .readlines <- function(x) { readLines(x, warn = FALSE) } - .add_pkgdown <- function(path = ".") { if (!isTRUE(.dir_is_package(path))) { - stop(".add_pkgdown() must be run from the root of a package.", call. = FALSE) + stop( + ".add_pkgdown() must be run from the root of a package.", + call. = FALSE + ) } url <- setdiff(desc::desc_get_urls(), .gh_url(path)) fn <- fs::path_join(c(path, "altdoc/pkgdown.yml")) @@ -141,16 +139,19 @@ "urls:", paste(" reference:", man), paste(" article:", vig), - "") + "" + ) cli::cli_alert_info("Adding altdoc/pkgdown.yml file.") writeLines(content, fn) } } - .add_rbuildignore <- function(x = "^docs$", path = ".") { if (!isTRUE(.dir_is_package(path))) { - stop(".add_rbuildignore() must be run from the root of a package.", call. = FALSE) + stop( + ".add_rbuildignore() must be run from the root of a package.", + call. = FALSE + ) } fn <- fs::path_join(c(path, ".Rbuildignore")) if (!fs::file_exists(fn)) { @@ -164,10 +165,12 @@ } } - .add_gitignore <- function(x = "^docs$", path = ".") { if (!isTRUE(.dir_is_package(path))) { - stop(".add_gitignore() must be run from the root of a package.", call. = FALSE) + stop( + ".add_gitignore() must be run from the root of a package.", + call. = FALSE + ) } fn <- fs::path_join(c(path, ".gitignore")) if (!fs::file_exists(fn)) { @@ -181,7 +184,6 @@ } } - .has_preamble <- function(fn) { x <- .readlines(fn) first_non_empty <- x[which(!x == "")[1]] diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/DESCRIPTION b/tests/testthat/examples/testpkg.altdoc.noURL/DESCRIPTION new file mode 100644 index 00000000..7b1ab3cf --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/DESCRIPTION @@ -0,0 +1,15 @@ +Package: testpkg.altdoc.noURL +Type: Package +Title: What the Package Does (Title Case) +Version: 0.1.0 +Author: Who wrote it +Maintainer: The package maintainer +Description: More about what it does (maybe more than one line) + Use four spaces when indenting paragraphs within the Description. +License: What license is it under? +Encoding: UTF-8 +LazyData: true +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 +Imports: + R6 diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/NAMESPACE b/tests/testthat/examples/testpkg.altdoc.noURL/NAMESPACE new file mode 100644 index 00000000..916be47d --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/NAMESPACE @@ -0,0 +1,7 @@ +# Generated by roxygen2: do not edit by hand + +export(examplesIf_false) +export(examplesIf_true) +export(hello_base) +export(hello_r6) +importFrom(R6,R6Class) diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/NEWS.md b/tests/testthat/examples/testpkg.altdoc.noURL/NEWS.md new file mode 100644 index 00000000..e99f4a96 --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/NEWS.md @@ -0,0 +1,9 @@ +# foobar 1.1.0 + +* thanks @foo-bar for their contribution (#111) + +* thanks @foo2- for their contribution (#11) + +* thanks @JohnDoe, @JaneDoe + +* this should not be linked: foo.bar@email.com diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R new file mode 100644 index 00000000..e23f4222 --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R @@ -0,0 +1,12 @@ +#' Examples If FALSE +#' +#' @param x A parameter +#' +#' @return Some value +#' @export +#' +#' @examplesIf 2 + 2 == 5 +#' examplesIf_false() +examplesIf_false <- function() { + print("Hello, world!") +} diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R new file mode 100644 index 00000000..0a1c4819 --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R @@ -0,0 +1,12 @@ +#' Examples If TRUE +#' +#' @param x A parameter +#' +#' @return Some value +#' @export +#' +#' @examplesIf 2 + 2 == 4 +#' examplesIf_true() +examplesIf_true <- function() { + print("Hello, world!") +} diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R new file mode 100644 index 00000000..55432bfc --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R @@ -0,0 +1,28 @@ +#' Base function +#' +#' @param x A parameter +#' +#' @details +#' Some code with weird symbols: `pl$when(condition)` and `pl$then(output)` +#' +#' Some equations: \eqn{\partial Y / \partial X = a + \varepsilon/2} +#' +#' +#' @return Some value +#' @export +#' +#' @seealso \code{\link[base]{print}}, \code{\link{hello_r6}} +#' +#' @references Ihaka R, Gentleman R (1996). +#' R: A Language for Data Analysis and Graphics. +#' \emph{Journal of Computational and Graphical Statistics}. \bold{5}(3), 299--314. +#' \doi{10.2307/139080} +#' +#' @examples +#' hello_base() +#' +#' mtcars$drat <- mtcars$drat + 1 +#' head(mtcars[["drat"]], 2) +hello_base <- function(x = 2) { + print("Hello, world!") +} diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R new file mode 100644 index 00000000..89c147f8 --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R @@ -0,0 +1,30 @@ +#' Create a "conductor" tour +#' +#' blah blah blah +#' @importFrom R6 R6Class +#' @export +hello_r6 <- R6::R6Class( + "Conductor", + private = list(x = 1), + + public = list( + + #' @details + #' Initialise `Conductor`. + initialize = function() {}, + + #' @param session A valid Shiny session. If `NULL` (default), the function + #' attempts to get the session with `shiny::getDefaultReactiveDomain()`. + #' + #' @details + #' Initialise `Conductor`. + init = function(session = NULL) {}, + + #' @param title Title of the popover. + #' + #' @details + #' Add a step in a `Conductor` tour. + + step = function(title = NULL) {} + ) +) diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/README.Rmd b/tests/testthat/examples/testpkg.altdoc.noURL/README.Rmd new file mode 100644 index 00000000..2fc3f4a9 --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/README.Rmd @@ -0,0 +1,41 @@ +--- +output: github_document +default-image-extension: "" +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" +) +``` + +# testpkg.altdoc + + +[![R-universe status badge](https://grantmcdermott.r-universe.dev/badges/plot2)](https://grantmcdermott.r-universe.dev) + + +The goal of testpkg.altdoc is to ... + +## Installation + +You can install the development version of testpkg.altdoc like so: + +``` r +# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE? +``` + +## Example + +This is a basic example which shows you how to solve a common problem: + +```{r example} +library(testpkg.altdoc) +summary(cars) +``` + diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/README.md b/tests/testthat/examples/testpkg.altdoc.noURL/README.md new file mode 100644 index 00000000..8c81433b --- /dev/null +++ b/tests/testthat/examples/testpkg.altdoc.noURL/README.md @@ -0,0 +1,36 @@ + + + +# testpkg.altdoc + + + +[![R-universe status +badge](https://grantmcdermott.r-universe.dev/badges/plot2)](https://grantmcdermott.r-universe.dev) + + +The goal of testpkg.altdoc is to … + +## Installation + +You can install the development version of testpkg.altdoc like so: + +``` r +# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE? +``` + +## Example + +This is a basic example which shows you how to solve a common problem: + +``` r +library(testpkg.altdoc) +summary(cars) +#> speed dist +#> Min. : 4.0 Min. : 2.00 +#> 1st Qu.:12.0 1st Qu.: 26.00 +#> Median :15.0 Median : 36.00 +#> Mean :15.4 Mean : 42.98 +#> 3rd Qu.:19.0 3rd Qu.: 56.00 +#> Max. :25.0 Max. :120.00 +``` diff --git a/tests/testthat/test-render_docs.R b/tests/testthat/test-render_docs.R index e818552b..c3aad7b4 100644 --- a/tests/testthat/test-render_docs.R +++ b/tests/testthat/test-render_docs.R @@ -25,12 +25,13 @@ test_that("docute: main files are correct", { expect_snapshot(.readlines("docs/man/hello_base.md"), variant = "docute") expect_snapshot(.readlines("docs/man/hello_r6.md"), variant = "docute") expect_snapshot(.readlines("docs/man/examplesIf_true.md"), variant = "docute") - expect_snapshot(.readlines("docs/man/examplesIf_false.md"), variant = "docute") + expect_snapshot( + .readlines("docs/man/examplesIf_false.md"), + variant = "docute" + ) expect_snapshot(.readlines("docs/vignettes/test.md"), variant = "docute") }) - - test_that("docsify: main files are correct", { skip_on_cran() skip_if(.is_windows() && .on_ci(), "Windows on CI") @@ -58,13 +59,17 @@ test_that("docsify: main files are correct", { expect_snapshot(.readlines("docs/NEWS.md"), variant = "docsify") expect_snapshot(.readlines("docs/man/hello_base.md"), variant = "docsify") expect_snapshot(.readlines("docs/man/hello_r6.md"), variant = "docsify") - expect_snapshot(.readlines("docs/man/examplesIf_true.md"), variant = "docsify") - expect_snapshot(.readlines("docs/man/examplesIf_false.md"), variant = "docsify") + expect_snapshot( + .readlines("docs/man/examplesIf_true.md"), + variant = "docsify" + ) + expect_snapshot( + .readlines("docs/man/examplesIf_false.md"), + variant = "docsify" + ) expect_snapshot(.readlines("docs/vignettes/test.md"), variant = "docsify") }) - - test_that("mkdocs: main files are correct", { skip_on_cran() skip_if_offline() # we download mkdocs every time @@ -84,10 +89,16 @@ test_that("mkdocs: main files are correct", { ### special mkdocs stuff if (.is_windows()) { shell("python3 -m venv .venv_altdoc") - shell(".venv_altdoc\\Scripts\\activate.bat && python3 -m pip install mkdocs --quiet") + shell( + ".venv_altdoc\\Scripts\\activate.bat && python3 -m pip install mkdocs --quiet" + ) } else { system2("python3", "-m venv .venv_altdoc") - system2("bash", "-c 'source .venv_altdoc/bin/activate && python3 -m pip install mkdocs --quiet'", stdout = FALSE) + system2( + "bash", + "-c 'source .venv_altdoc/bin/activate && python3 -m pip install mkdocs --quiet'", + stdout = FALSE + ) } ### generate docs @@ -104,8 +115,6 @@ test_that("mkdocs: main files are correct", { expect_snapshot(.readlines("docs/vignettes/test.md"), variant = "mkdocs") }) - - test_that("quarto: no error for basic workflow", { skip_on_cran() skip_if(.is_windows() && .on_ci(), "Windows on CI") @@ -138,6 +147,28 @@ test_that("quarto: no error for basic workflow", { # expect_snapshot(.readlines("docs/vignettes/test.html")) }) +# https://github.com/etiennebacher/altdoc/issues/307 +test_that("quarto: no error for basic workflow, no Github URL", { + skip_on_cran() + skip_if(.is_windows() && .on_ci(), "Windows on CI") + + ### setup: create a temp package using the structure of testpkg.altdoc.noURL + path_to_example_pkg <- fs::path_abs( + test_path("examples/testpkg.altdoc.noURL") + ) + create_local_project() + fs::dir_delete("R") + fs::dir_copy(path_to_example_pkg, ".") + all_files <- list.files("testpkg.altdoc.noURL", full.names = TRUE) + for (i in all_files) { + fs::file_move(i, ".") + } + fs::dir_delete("testpkg.altdoc.noURL") + + install.packages(".", repos = NULL, type = "source") + setup_docs("quarto_website") + expect_no_error(render_docs(verbose = TRUE)) +}) test_that("quarto: autolink", { skip_on_cran() @@ -161,10 +192,11 @@ test_that("quarto: autolink", { expect_no_error(render_docs(verbose = .on_ci())) tmp <- .readlines("docs/vignettes/test.html") - expect_true(any(grepl("https://rdrr.io/r/base/library.html", tmp, fixed = TRUE))) + expect_true( + any(grepl("https://rdrr.io/r/base/library.html", tmp, fixed = TRUE)) + ) }) - # Test failures ------------------------------ test_that("render_docs errors if vignettes fail", { @@ -181,7 +213,10 @@ test_that("render_docs errors if vignettes fail", { test_that("render_docs errors if man fail", { create_local_package() fs::dir_create("man") - cat("\\name{hi}\n\\title{hi}\n\\usage{\nhi()\n}\n\\examples{\n1 +\n}\n", file = "man/foo.Rd") + cat( + "\\name{hi}\n\\title{hi}\n\\usage{\nhi()\n}\n\\examples{\n1 +\n}\n", + file = "man/foo.Rd" + ) setup_docs("docute", path = getwd()) expect_error( render_docs(path = getwd()), From 17a246f631b9e4ca0d319293dd16c46656af8799 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:26:59 +0100 Subject: [PATCH 2/8] bump description --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0ca8a8b8..abf67cb1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: altdoc Title: Package Documentation Websites with 'Quarto', 'Docsify', 'Docute', or 'MkDocs' -Version: 0.5.0 +Version: 0.5.0.9000 Authors@R: c(person(given = "Etienne", family = "Bacher", From c8a7952700d1695f5e2d3a24b83e0745f90bcbc0 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:36:24 +0100 Subject: [PATCH 3/8] reformat --- .../testpkg.altdoc.noURL/R/examplesIf_false.R | 2 +- .../testpkg.altdoc.noURL/R/examplesIf_true.R | 2 +- .../testpkg.altdoc.noURL/R/hello_base.R | 2 +- .../testpkg.altdoc.noURL/R/hello_r6.R | 40 ++++++++++--------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R index e23f4222..5dbadb01 100644 --- a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_false.R @@ -8,5 +8,5 @@ #' @examplesIf 2 + 2 == 5 #' examplesIf_false() examplesIf_false <- function() { - print("Hello, world!") + print("Hello, world!") } diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R index 0a1c4819..aa3e937e 100644 --- a/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/examplesIf_true.R @@ -8,5 +8,5 @@ #' @examplesIf 2 + 2 == 4 #' examplesIf_true() examplesIf_true <- function() { - print("Hello, world!") + print("Hello, world!") } diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R index 55432bfc..38ee7702 100644 --- a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_base.R @@ -24,5 +24,5 @@ #' mtcars$drat <- mtcars$drat + 1 #' head(mtcars[["drat"]], 2) hello_base <- function(x = 2) { - print("Hello, world!") + print("Hello, world!") } diff --git a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R index 89c147f8..f0cd6084 100644 --- a/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R +++ b/tests/testthat/examples/testpkg.altdoc.noURL/R/hello_r6.R @@ -4,27 +4,29 @@ #' @importFrom R6 R6Class #' @export hello_r6 <- R6::R6Class( - "Conductor", - private = list(x = 1), + "Conductor", + private = list(x = 1), - public = list( + public = list( + #' @details + #' Initialise `Conductor`. + initialize = function() { + }, - #' @details - #' Initialise `Conductor`. - initialize = function() {}, + #' @param session A valid Shiny session. If `NULL` (default), the function + #' attempts to get the session with `shiny::getDefaultReactiveDomain()`. + #' + #' @details + #' Initialise `Conductor`. + init = function(session = NULL) { + }, - #' @param session A valid Shiny session. If `NULL` (default), the function - #' attempts to get the session with `shiny::getDefaultReactiveDomain()`. - #' - #' @details - #' Initialise `Conductor`. - init = function(session = NULL) {}, + #' @param title Title of the popover. + #' + #' @details + #' Add a step in a `Conductor` tour. - #' @param title Title of the popover. - #' - #' @details - #' Add a step in a `Conductor` tour. - - step = function(title = NULL) {} - ) + step = function(title = NULL) { + } + ) ) From 946aa91c137317c0a094b895a9673616e23aca2d Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:39:16 +0100 Subject: [PATCH 4/8] remove conflict --- R/utils.R | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/R/utils.R b/R/utils.R index 50692554..298d7e27 100644 --- a/R/utils.R +++ b/R/utils.R @@ -144,27 +144,6 @@ cli::cli_alert_info("Adding altdoc/pkgdown.yml file.") writeLines(content, fn) } - if (!isTRUE(.dir_is_package(path))) { - stop( - ".add_pkgdown() must be run from the root of a package.", - call. = FALSE - ) - } - url <- setdiff(desc::desc_get_urls(), .gh_url(path)) - fn <- fs::path_join(c(path, "altdoc/pkgdown.yml")) - if (!fs::file_exists(fn) && length(url) > 0) { - url <- url[1] - vig <- fs::path_join(c(url, "vignettes")) - man <- fs::path_join(c(url, "man")) - content <- c( - "urls:", - paste(" reference:", man), - paste(" article:", vig), - "" - ) - cli::cli_alert_info("Adding altdoc/pkgdown.yml file.") - writeLines(content, fn) - } } .add_rbuildignore <- function(x = "^docs$", path = ".") { @@ -184,22 +163,6 @@ tmp <- c(tmp, x) writeLines(tmp, fn) } - if (!isTRUE(.dir_is_package(path))) { - stop( - ".add_rbuildignore() must be run from the root of a package.", - call. = FALSE - ) - } - fn <- fs::path_join(c(path, ".Rbuildignore")) - if (!fs::file_exists(fn)) { - fs::file_create(fn) - } - tmp <- .readlines(fn) - if (!x %in% tmp) { - cli::cli_alert_info("Adding {x} to .Rbuildignore") - tmp <- c(tmp, x) - writeLines(tmp, fn) - } } .add_gitignore <- function(x = "^docs$", path = ".") { @@ -219,22 +182,6 @@ tmp <- c(tmp, x) writeLines(tmp, fn) } - if (!isTRUE(.dir_is_package(path))) { - stop( - ".add_gitignore() must be run from the root of a package.", - call. = FALSE - ) - } - fn <- fs::path_join(c(path, ".gitignore")) - if (!fs::file_exists(fn)) { - fs::file_create(fn) - } - tmp <- .readlines(fn) - if (!x %in% tmp) { - cli::cli_alert_info("Adding {x} to .gitignore") - tmp <- c(tmp, x) - writeLines(tmp, fn) - } } .has_preamble <- function(fn) { From be6c5df65e7072755b33fd9ce6d6873b284dcf00 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:47:15 +0100 Subject: [PATCH 5/8] fix --- R/import_readme.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/import_readme.R b/R/import_readme.R index f604df53..c03124a5 100644 --- a/R/import_readme.R +++ b/R/import_readme.R @@ -53,7 +53,12 @@ } } - tar_file <- fs::path_join(c(tar_dir, "README.md")) + if (tool == "quarto_website") { + tar_file <- fs::path_join(c(tar_dir, "index.md")) + } else { + tar_file <- fs::path_join(c(tar_dir, "README.md")) + } + src_file <- fs::path_join(c(src_dir, "README.md")) fs::file_copy(src_file, tar_file, overwrite = TRUE) .check_md_structure(tar_file) From 51afdfa2e60c8960340acfaf88d23c350656e00e Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:48:03 +0100 Subject: [PATCH 6/8] typo --- tests/testthat/test-render_docs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-render_docs.R b/tests/testthat/test-render_docs.R index 1d1f1356..ffc6b622 100644 --- a/tests/testthat/test-render_docs.R +++ b/tests/testthat/test-render_docs.R @@ -170,7 +170,7 @@ test_that("quarto: no error for basic workflow, no Github URL", { install.packages(".", repos = NULL, type = "source") setup_docs("quarto_website") - expect_no_error(render_docs(verbose = TRUE)) + expect_no_error(render_docs(verbose = .on_ci())) }) test_that("quarto: autolink", { From addb146537b3bac3273091f9145d9cecce042e2f Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 18:56:56 +0100 Subject: [PATCH 7/8] fix --- R/import_readme.R | 7 +------ tests/testthat/test-render_docs.R | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/R/import_readme.R b/R/import_readme.R index c03124a5..f604df53 100644 --- a/R/import_readme.R +++ b/R/import_readme.R @@ -53,12 +53,7 @@ } } - if (tool == "quarto_website") { - tar_file <- fs::path_join(c(tar_dir, "index.md")) - } else { - tar_file <- fs::path_join(c(tar_dir, "README.md")) - } - + tar_file <- fs::path_join(c(tar_dir, "README.md")) src_file <- fs::path_join(c(src_dir, "README.md")) fs::file_copy(src_file, tar_file, overwrite = TRUE) .check_md_structure(tar_file) diff --git a/tests/testthat/test-render_docs.R b/tests/testthat/test-render_docs.R index ffc6b622..b06ee6c0 100644 --- a/tests/testthat/test-render_docs.R +++ b/tests/testthat/test-render_docs.R @@ -135,7 +135,6 @@ test_that("quarto: no error for basic workflow", { ### generate docs install.packages(".", repos = NULL, type = "source") - fs::file_move("README.Rmd", "README.qmd") # special thing quarto setup_docs("quarto_website") expect_no_error(render_docs(verbose = .on_ci())) @@ -190,7 +189,6 @@ test_that("quarto: autolink", { ### generate docs install.packages(".", repos = NULL, type = "source") - fs::file_move("README.Rmd", "README.qmd") # special thing quarto setup_docs("quarto_website") expect_no_error(render_docs(verbose = .on_ci())) From c998067405f90339f5b4b5d704f0279835cdcf3f Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Fri, 7 Feb 2025 19:00:51 +0100 Subject: [PATCH 8/8] fix? --- R/import_readme.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/import_readme.R b/R/import_readme.R index f604df53..8496981f 100644 --- a/R/import_readme.R +++ b/R/import_readme.R @@ -53,7 +53,11 @@ } } - tar_file <- fs::path_join(c(tar_dir, "README.md")) + if (tool == "quarto_website") { + tar_file <- fs::path_join(c(tar_dir, "index.md")) + } else { + tar_file <- fs::path_join(c(tar_dir, "README.md")) + } src_file <- fs::path_join(c(src_dir, "README.md")) fs::file_copy(src_file, tar_file, overwrite = TRUE) .check_md_structure(tar_file)