From 06968e2538a0c68538529ffaa8b6a6bbfe781b0f Mon Sep 17 00:00:00 2001 From: StatnMap Date: Tue, 7 May 2024 19:04:36 +0200 Subject: [PATCH] fix: remove setup name in vignettes --- R/inflate-utils.R | 2 +- R/inflate.R | 4 +++- dev/README.md | 4 ++-- dev/dev_history_cran.R | 6 ++++++ dev/flat_get_package_structure.Rmd | 2 +- inst/rmarkdown/templates/additional/skeleton/skeleton.Rmd | 2 +- tests/testthat/test-inflate-part1.R | 5 ++++- vignettes/deal-with-a-fusen-flat-file.Rmd | 2 +- .../draw-a-map-of-your-package-files-and-functions.Rmd | 4 +--- vignettes/inflate-all-your-flat-files.Rmd | 2 +- vignettes/register-files-in-config.Rmd | 2 +- vignettes/share-on-a-github-website.Rmd | 2 +- 12 files changed, 23 insertions(+), 14 deletions(-) diff --git a/R/inflate-utils.R b/R/inflate-utils.R index df6fa739..b11019e0 100644 --- a/R/inflate-utils.R +++ b/R/inflate-utils.R @@ -498,7 +498,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(.{pkgname}.) ``` ', diff --git a/R/inflate.R b/R/inflate.R index 0943623f..d741ba3a 100644 --- a/R/inflate.R +++ b/R/inflate.R @@ -365,7 +365,9 @@ inflate <- function(pkg = ".", flat_file, # Restart RStudio - if (needs_restart) { + is_rstudio <- Sys.getenv("RSTUDIO") == "1" + + if (needs_restart & is_rstudio) { cli::cat_rule("RStudio restart needed") getFromNamespace("restart_rstudio", "usethis")("A restart of RStudio is required to activate the Build pane") } diff --git a/dev/README.md b/dev/README.md index b262cda7..6fcf4150 100644 --- a/dev/README.md +++ b/dev/README.md @@ -81,9 +81,9 @@ usethis::with_project(here::here(), { - flat\_title - dev\_history.Rmd - path - - dev/flat\_history\_core.Rmd + - dev/flat\_history/flat\_history\_core.Rmd - state - - 🛑 inactive + - 🛑 deprecated - R - R/fill\_description.R - 👀 fill\_description diff --git a/dev/dev_history_cran.R b/dev/dev_history_cran.R index 72455aab..d24eebac 100644 --- a/dev/dev_history_cran.R +++ b/dev/dev_history_cran.R @@ -21,12 +21,18 @@ unlink(skeleton_dir, recursive = TRUE) # _Check in interactive test-inflate for templates and Addins ---- pkgload::load_all() +# /!\ While running these tests manually with `test_file()`, +# do not do anything else in your IDE /!\ +# Do not change file open, do not change text in the current file, nothing... +# Unit tests open files interactively and close them +# The focus needs to be kept on what the test is doing Sys.setenv("NOT_CRAN" = "true") testthat::test_dir("tests/testthat/") testthat::test_file("tests/testthat/test-inflate-part1.R") testthat::test_file("tests/testthat/test-inflate-part2.R") testthat::test_file("tests/testthat/test-inflate_all.R") testthat::test_file("tests/testthat/test-inflate_all_utils.R") +testthat::test_file("tests/testthat/test-build_fusen_chunks.R") # Opens files testthat::test_file("tests/testthat/test-add_flat_template.R") testthat::test_file("tests/testthat/test-skeleton.R") testthat::test_file("tests/testthat/test-register_config_file.R") # interactivity diff --git a/dev/flat_get_package_structure.Rmd b/dev/flat_get_package_structure.Rmd index c8332dfa..549223e9 100644 --- a/dev/flat_get_package_structure.Rmd +++ b/dev/flat_get_package_structure.Rmd @@ -211,7 +211,7 @@ draw_the_tree <- function(structure_list, silent = FALSE) { } ``` -```{r examples-get_package_structure, eval=FALSE} +```{r examples-get_package_structure} #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() diff --git a/inst/rmarkdown/templates/additional/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/additional/skeleton/skeleton.Rmd index 42d0fe0f..b549d316 100644 --- a/inst/rmarkdown/templates/additional/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/additional/skeleton/skeleton.Rmd @@ -34,7 +34,7 @@ skeleton() ```{r tests-skeleton} test_that("skeleton works", { - + expect_true(inherits(skeleton, "function")) }) ``` diff --git a/tests/testthat/test-inflate-part1.R b/tests/testthat/test-inflate-part1.R index 62072d01..02a27a88 100644 --- a/tests/testthat/test-inflate-part1.R +++ b/tests/testthat/test-inflate-part1.R @@ -457,7 +457,10 @@ usethis::with_project(dummypackage, { usethis::with_project(dummypackage, { file.remove(file.path(dummypackage, ".here")) file.remove(file.path(dummypackage, ".Rbuildignore")) - cat("", file = file.path(dummypackage, "dummy.Rproj")) + cat("", file = file.path( + dummypackage, + paste0(basename(dummypackage), ".Rproj") + )) # Add # {fusen} steps diff --git a/vignettes/deal-with-a-fusen-flat-file.Rmd b/vignettes/deal-with-a-fusen-flat-file.Rmd index f5810df3..8bc79a81 100644 --- a/vignettes/deal-with-a-fusen-flat-file.Rmd +++ b/vignettes/deal-with-a-fusen-flat-file.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(fusen) ``` diff --git a/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd b/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd index 1ada4948..aae2679e 100644 --- a/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd +++ b/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(fusen) ``` @@ -40,8 +40,6 @@ You can know: With `draw_the_map()`, you can draw a tree of the package structure in the console. ```{r examples-get_package_structure} -#| eval: no - #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() diff --git a/vignettes/inflate-all-your-flat-files.Rmd b/vignettes/inflate-all-your-flat-files.Rmd index 6cc79dad..7326e38f 100644 --- a/vignettes/inflate-all-your-flat-files.Rmd +++ b/vignettes/inflate-all-your-flat-files.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(fusen) ``` diff --git a/vignettes/register-files-in-config.Rmd b/vignettes/register-files-in-config.Rmd index b3b6cc1b..03c87458 100644 --- a/vignettes/register-files-in-config.Rmd +++ b/vignettes/register-files-in-config.Rmd @@ -15,7 +15,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(fusen) ``` diff --git a/vignettes/share-on-a-github-website.Rmd b/vignettes/share-on-a-github-website.Rmd index 26406f59..c7f86ef4 100644 --- a/vignettes/share-on-a-github-website.Rmd +++ b/vignettes/share-on-a-github-website.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( ) ``` -```{r setup} +```{r} library(fusen) ```