From 06968e2538a0c68538529ffaa8b6a6bbfe781b0f Mon Sep 17 00:00:00 2001 From: StatnMap Date: Tue, 7 May 2024 19:04:36 +0200 Subject: [PATCH 1/7] 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) ``` From b402a3267d4e8c64a35b2fecf9bfdc295f0ba992 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 12:29:15 +0200 Subject: [PATCH 2/7] doc: update doc with last infos --- README.Rmd | 36 +++++---- README.md | 74 ++++++++++--------- dev/README.Rmd | 4 +- dev/README.md | 7 +- dev/config_fusen.yaml | 4 +- dev/flat_get_package_structure.Rmd | 2 +- .../flat_history}/R-CMD-check-centos.yaml | 0 vignettes/Maintain-packages-with-fusen.Rmd | 16 ++-- ...e-of-your-package-files-and-functions.Rmd} | 6 +- vignettes/tips-and-tricks.Rmd | 27 +++++-- 10 files changed, 104 insertions(+), 72 deletions(-) rename {.github/workflows => dev/flat_history}/R-CMD-check-centos.yaml (100%) rename vignettes/{draw-a-map-of-your-package-files-and-functions.Rmd => draw-a-tree-of-your-package-files-and-functions.Rmd} (94%) diff --git a/README.Rmd b/README.Rmd index 8ed962ab..05619f59 100644 --- a/README.Rmd +++ b/README.Rmd @@ -34,10 +34,10 @@ knitr::include_graphics("man/figures/fusen_inflate_functions.png") _Fill the flat Rmd (or qmd) template with everything in one place and {fusen} will inflate the identified parts in the correct package files and directories._ -> The {fusen} Rmarkdown template encourages users to fill their documentation and tests at the same time of writing their functions code. Thanks to the R package structure used by {fusen}, you can built a robust workflow or R package. {fusen} simplifies and reduces the number of steps towards a full R package. +> The {fusen} Rmarkdown template encourages users to fill their documentation and tests at the same time of writing their functions code. Thanks to the R package structure used by {fusen}, you can build a robust workflow or R package. {fusen} simplifies and reduces the number of steps towards a full R package. > After that, your {pkgdown} documentation website is one command away to be shared with all your users. -This {fusen} package is a real-world example of {fusen} use as it was itself created from the flat templates available in `"dev/"` folder in its GitHub repository. +This {fusen} package is a real-world example of {fusen} use as it is itself created from the flat templates available in `"dev/"` folder in its GitHub repository. You can have a look at its architecture in the [Readme of the "dev" directory](https://github.com/ThinkR-open/fusen/blob/main/dev/README.md). ## Installation @@ -49,20 +49,15 @@ install.packages("fusen") > *Full documentation for the CRAN version is here: https://thinkr-open.github.io/fusen/* -You can install the development version of {fusen} from GitHub: +You can install the development version of {fusen} from r-universe or GitHub: ```{r, eval=FALSE} # From r-universe.dev (No need for GITHUB_PAT) -options(repos = c( - thinkropen = "https://thinkr-open.r-universe.dev", - CRAN = "https://cloud.r-project.org" -)) -# Download and install {fusen} in R -install.packages("fusen") +install.packages("fusen", repos = c("https://thinkr-open.r-universe.dev", "https://cloud.r-project.org")) -# With {remotes} using GitHub API - Need for GITHUB_PAT -# install.packages("remotes") -remotes::install_github("ThinkR-open/fusen") +# Or with {pak} using GitHub API - Need for GITHUB_PAT +# install.packages("pak") +pak::pak("ThinkR-open/fusen") ``` > *Full documentation for the development version is here: https://thinkr-open.github.io/fusen/dev/* @@ -144,19 +139,21 @@ _Note that the `"flat*.Rmd"` files created with templates `full` and `teaching` There is a dedicated vignette to answer this: https://thinkr-open.github.io/fusen/articles/Maintain-packages-with-fusen.html -- **Option 1**: Modifications are only added to the "flat_template.Rmd" file, which then is inflated to update all packages files -- **Option 2**: Modifications are realized in the package files directly, and the "flat_template.Rmd" file must be protected from any use. +- **Option 1**: After a first inflate of your flat file, you can continue developing in the "flat_template.Rmd" file, and then inflate it using `fusen::inflat_all()` +- **Option 2**: After you're done with inflating, you can decide to deprecate your flat file with `fusen::deprecate_flat_file()` and develop in the package files directly, as for any other R package. 'fusen' has no impact on the structure of a classical package once inflated. > Advice : Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place ## Who is {fusen} for? -When you write a Rmarkdown file (or a vignette), you create a documentation for your analysis (or package). Inside, you write some functions, you test your functions with examples and you maybe write some unit tests to verify the outputs. This is even more true if you follow this guide : ['Rmd first': When development starts with documentation](https://rtask.thinkr.fr/when-development-starts-with-documentation/) -After that, you need to move your functions and scripts in the correct place. Let {fusen} do that for you! +If you mind about documentation for your users and tests for your maintainers, {fusen} is for you. Start writing documentation and tests while you conceive your functionalities, so that there are directly available for your users and maintainers. + +Indeed, when you write a Rmarkdown file (or a vignette), you create a documentation for your analysis (or package). When you write some functions, you check your functions with examples and you maybe write some unit tests to verify the outputs. This is even more true if you follow this guide : ['Rmd first': When development starts with documentation](https://rtask.thinkr.fr/when-development-starts-with-documentation/) +Write them all in the same file while you explore the possibilities and let {fusen} store them in the right place for you! -*{fusen} is first addressed to people who never wrote a package before* but know how to write a Rmarkdown file. Understanding package infrastructure and correctly settling it can be frightening. This package may help them do the first step! +*{fusen} was first addressed to people who never wrote a package before* and know how to write a Rmarkdown file. Understanding package infrastructure and correctly settling it can be frightening. This package may help them do the first step! -*{fusen} is also addressed to more advanced developers who are fed up with switching* between R files, tests files, vignettes. In particular, when changing arguments of a function, we need to change examples, unit tests in multiple places. Here, you can do it in one place. No risk to forget one. Think also about code review: everything related to one function is at the same place. +*{fusen} is also addressed to more advanced developers who care about their users and the sustainability of their products, and are fed up with switching* between R files, tests files, vignettes while they prototype their functions. In particular, when changing arguments of a function, we need to change examples, unit tests in multiple places. Here, you can do it in one place. No risk to forget one. Think also about code review: everything related to one function is at the same place. ## Q&A : All tips and tricks of a {fusen} template @@ -169,12 +166,13 @@ After that, you need to move your functions and scripts in the correct place. Le - How to create a vignette with different title and Index Entry? - How not to create a vignette ? - How to get a pre-filled template for a specific function name ? -- How to Inflate multiple flat files ? +- How to inflate multiple flat files ? - How to store multiple functions in a unique R file ? - How to read dataset that I usually put in “tests/testthat/” for my unit tests? - Can I load all functions of the current flat file during development without having to `inflate()`? - Can I inflate a Quarto qmd file? - Can I use {fusen} with {golem}? +- How can I know if R files were created from a flat or not ? => See vignette Tips and Tricks: https://thinkr-open.github.io/fusen/articles/tips-and-tricks.html diff --git a/README.md b/README.md index 4a404c4b..7ce41566 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,17 @@ and directories.* > The {fusen} Rmarkdown template encourages users to fill their > documentation and tests at the same time of writing their functions -> code. Thanks to the R package structure used by {fusen}, you can built +> code. Thanks to the R package structure used by {fusen}, you can build > a robust workflow or R package. {fusen} simplifies and reduces the > number of steps towards a full R package. > After that, your {pkgdown} documentation website is one command away > to be shared with all your users. -This {fusen} package is a real-world example of {fusen} use as it was +This {fusen} package is a real-world example of {fusen} use as it is itself created from the flat templates available in `"dev/"` folder in -its GitHub repository. +its GitHub repository. You can have a look at its architecture in the +[Readme of the “dev” +directory](https://github.com/ThinkR-open/fusen/blob/main/dev/README.md). ## Installation @@ -48,20 +50,16 @@ install.packages("fusen") > *Full documentation for the CRAN version is here: > * -You can install the development version of {fusen} from GitHub: +You can install the development version of {fusen} from r-universe or +GitHub: ``` r # From r-universe.dev (No need for GITHUB_PAT) -options(repos = c( - thinkropen = "https://thinkr-open.r-universe.dev", - CRAN = "https://cloud.r-project.org" -)) -# Download and install {fusen} in R -install.packages("fusen") +install.packages("fusen", repos = c("https://thinkr-open.r-universe.dev", "https://cloud.r-project.org")) -# With {remotes} using GitHub API - Need for GITHUB_PAT -# install.packages("remotes") -remotes::install_github("ThinkR-open/fusen") +# Or with {pak} using GitHub API - Need for GITHUB_PAT +# install.packages("pak") +pak::pak("ThinkR-open/fusen") ``` > *Full documentation for the development version is here: @@ -180,38 +178,47 @@ for your chunks. There is a dedicated vignette to answer this: - - **Option 1**: Modifications are only added to the - “flat\_template.Rmd” file, which then is inflated to update all - packages files - - **Option 2**: Modifications are realized in the package files - directly, and the “flat\_template.Rmd” file must be protected from - any use. + - **Option 1**: After a first inflate of your flat file, you can + continue developing in the “flat\_template.Rmd” file, and then + inflate it using `fusen::inflat_all()` + - **Option 2**: After you’re done with inflating, you can decide to + deprecate your flat file with `fusen::deprecate_flat_file()` and + develop in the package files directly, as for any other R package. + ‘fusen’ has no impact on the structure of a classical package once + inflated. > Advice : Use git as soon as possible, this will avoid losing your work > if you made some modifications in the wrong place ## Who is {fusen} for? -When you write a Rmarkdown file (or a vignette), you create a -documentation for your analysis (or package). Inside, you write some -functions, you test your functions with examples and you maybe write +If you mind about documentation for your users and tests for your +maintainers, {fusen} is for you. Start writing documentation and tests +while you conceive your functionalities, so that there are directly +available for your users and maintainers. + +Indeed, when you write a Rmarkdown file (or a vignette), you create a +documentation for your analysis (or package). When you write some +functions, you check your functions with examples and you maybe write some unit tests to verify the outputs. This is even more true if you follow this guide : [‘Rmd first’: When development starts with documentation](https://rtask.thinkr.fr/when-development-starts-with-documentation/) -After that, you need to move your functions and scripts in the correct -place. Let {fusen} do that for you\! +Write them all in the same file while you explore the possibilities and +let {fusen} store them in the right place for you\! -*{fusen} is first addressed to people who never wrote a package before* -but know how to write a Rmarkdown file. Understanding package +*{fusen} was first addressed to people who never wrote a package before* +and know how to write a Rmarkdown file. Understanding package infrastructure and correctly settling it can be frightening. This package may help them do the first step\! -*{fusen} is also addressed to more advanced developers who are fed up -with switching* between R files, tests files, vignettes. In particular, -when changing arguments of a function, we need to change examples, unit -tests in multiple places. Here, you can do it in one place. No risk to -forget one. Think also about code review: everything related to one -function is at the same place. +*{fusen} is also addressed to more advanced developers who care about +their users and the sustainability of their products, and are fed up +with switching* between R files, tests files, vignettes while they +prototype their functions. In particular, when changing arguments of a +function, we need to change examples, unit tests in multiple places. +Here, you can do it in one place. No risk to forget one. Think also +about code review: everything related to one function is at the same +place. ## Q\&A : All tips and tricks of a {fusen} template @@ -224,7 +231,7 @@ function is at the same place. - How to create a vignette with different title and Index Entry? - How not to create a vignette ? - How to get a pre-filled template for a specific function name ? - - How to Inflate multiple flat files ? + - How to inflate multiple flat files ? - How to store multiple functions in a unique R file ? - How to read dataset that I usually put in “tests/testthat/” for my unit tests? @@ -232,6 +239,7 @@ function is at the same place. without having to `inflate()`? - Can I inflate a Quarto qmd file? - Can I use {fusen} with {golem}? + - How can I know if R files were created from a flat or not ? \=\> See vignette Tips and Tricks: diff --git a/dev/README.Rmd b/dev/README.Rmd index 857b8af3..69fb6d6c 100644 --- a/dev/README.Rmd +++ b/dev/README.Rmd @@ -4,10 +4,12 @@ output: github_document # Here is a map of the architecture of the 'fusen' project +The _keep_ section is for independent files, which were not issued from a flat file. + ```{r, message=FALSE, results='asis'} pkgload::load_all() usethis::with_project(here::here(), { - draw_the_tree(silent = TRUE) + fusen::draw_the_tree(silent = TRUE) }) ``` diff --git a/dev/README.md b/dev/README.md index 6fcf4150..9a3d582f 100644 --- a/dev/README.md +++ b/dev/README.md @@ -1,11 +1,14 @@ # Here is a map of the architecture of the ‘fusen’ project +The *keep* section is for independent files, which were not issued from +a flat file. + ``` r pkgload::load_all() usethis::with_project(here::here(), { - draw_the_tree(silent = TRUE) + fusen::draw_the_tree(silent = TRUE) }) ``` @@ -76,7 +79,7 @@ usethis::with_project(here::here(), { - tests/testthat/test-get\_package\_structure.R - tests/testthat/test-get\_all\_created\_funs.R - vignettes - - vignettes/draw-a-map-of-your-package-files-and-functions.Rmd + - vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd - flat\_history\_core.Rmd - flat\_title - dev\_history.Rmd diff --git a/dev/config_fusen.yaml b/dev/config_fusen.yaml index 893e84ce..dd3d9cfe 100644 --- a/dev/config_fusen.yaml +++ b/dev/config_fusen.yaml @@ -51,10 +51,10 @@ flat_get_package_structure.Rmd: tests: - tests/testthat/test-get_package_structure.R - tests/testthat/test-get_all_created_funs.R - vignettes: vignettes/draw-a-map-of-your-package-files-and-functions.Rmd + vignettes: vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd inflate: flat_file: dev/flat_get_package_structure.Rmd - vignette_name: Draw a map of your package files and functions + vignette_name: Draw a tree of your package files and functions open_vignette: true check: true document: true diff --git a/dev/flat_get_package_structure.Rmd b/dev/flat_get_package_structure.Rmd index 549223e9..1a307e02 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} +```{r examples-get_package_structure, eval=TRUE} #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() diff --git a/.github/workflows/R-CMD-check-centos.yaml b/dev/flat_history/R-CMD-check-centos.yaml similarity index 100% rename from .github/workflows/R-CMD-check-centos.yaml rename to dev/flat_history/R-CMD-check-centos.yaml diff --git a/vignettes/Maintain-packages-with-fusen.Rmd b/vignettes/Maintain-packages-with-fusen.Rmd index 5f27af33..5195aae7 100644 --- a/vignettes/Maintain-packages-with-fusen.Rmd +++ b/vignettes/Maintain-packages-with-fusen.Rmd @@ -48,33 +48,37 @@ Take it as a documentation for the other developers. Maintaining such a package requires a choice: - **Option 1**: Modifications are only added to the "flat_template.Rmd" file, which then is inflated to update all packages files -- **Option 2**: Modifications are realized in the package files directly, and the "flat_template.Rmd" file must be protected from any use. +- **Option 2**: Modifications are realized in the package files directly as for any other package, and the "flat_template.Rmd" file must be deprecated using `deprecate_flat_file()`. Your first `inflate()` may not directly work as expected as with any R code that you write. In this case, you can continue to implement your functionality using **Option 1**. -> Advice 1 : Use Option 1 until you find it too complicated to be used ! I assure you, you will find the moment when you say : ok this is not possible anymore... +> Advice 1: Use Option 1 until you find it too complicated to be used ! I assure you, you will find the moment when you say : ok this is not possible anymore... -> Advice 2 : Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place +> Advice 2: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place + +> Advice 3: Create a Readme.Rmd in the "dev/" directory with a chunk having `fusen::draw_the_tree()` and knit it. This will help to understand the structure of your package and see what is inflated or not. Have a look at the {fusen} package itself on GitHub to see how it looks like. ## Option 1: Continue with the "flat_template.Rmd" +- (+) You are encouraged to start with documenting and testing your package before you start coding, which is generally a good practice for prototyping. - (+) This does not require to fully understand the package structure and files to continue building your package, and you continue to develop in a unique file -- (+) You are encouraged to continue documenting and testing all parts of your package - (-) You need to pay attention to checking and debugging tools that may direct you to the R file directly. This requires to pay attention and always be sure you are modifying code in the flat template file, to be inflated. - (-) This may trouble co-developers who already built packages => {fusen} itself is built as is. Each modification is added to the dedicated dev_history file and then inflated - +=> The tree structure in the "dev/Readme.md" file is very useful to understand what is inflated or not, and to see the structure of the package ## Option 2: Maintain like a classical package - (+) You can use dedicated checking and debugging tools as is, in particular in RStudio. There are built to direct you as quickly as possible to the source of the problem - (+) This allows collaboration with more advanced developers who are used to debug in the package structure directly +- (-) You need to remember that you need to care about your users and maintainers, and that you need to document and test your code as soon as possible, in a different place than the code itself. - (-) This requires to understand the structure and files of a package and how they interact each other, and be able to jump from one file to the other, in the correct folder. This may drives you lazy to continue documenting and testing your modifications -- This requires to protect the flat template file, so that you never use it again. `` is the minimum. Then you can add ``, and you can rename the old template with "old-flat_template.Rmd" for instance. + +You can use `deprecate_flat_file()` to protect the original flat template file, so that you never use it again. Inflated files are also unprotected, so that you can modify them directly. => This is the way I add new functionalities in packages that started in the old way, and in specific cases where inflating is now too complicated, like for function `inflate()` and all its unit tests in this very {fusen} package. diff --git a/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd similarity index 94% rename from vignettes/draw-a-map-of-your-package-files-and-functions.Rmd rename to vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd index aae2679e..3bddba12 100644 --- a/vignettes/draw-a-map-of-your-package-files-and-functions.Rmd +++ b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd @@ -1,8 +1,8 @@ --- -title: "Draw a map of your package files and functions" +title: "Draw a tree of your package files and functions" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Draw a map of your package files and functions} + %\VignetteIndexEntry{Draw a tree of your package files and functions} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- @@ -40,6 +40,8 @@ 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: yes + #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() diff --git a/vignettes/tips-and-tricks.Rmd b/vignettes/tips-and-tricks.Rmd index ba731066..e9c0a412 100644 --- a/vignettes/tips-and-tricks.Rmd +++ b/vignettes/tips-and-tricks.Rmd @@ -65,7 +65,9 @@ I created a chunk `example` but I do not want the example to be run in the funct ```` ```{r function-myfunction}`r ''` -myfunction <- function(x) {x} +myfunction <- function(x) { + x +} ``` ```{r example-myfunction, eval=FALSE}`r ''` @@ -174,7 +176,7 @@ flat_rmd <- sub("^HERE$", chunks, flat_rmd) writeLines(flat_rmd, path_flat_rmd) ``` -# How to Inflate multiple flat files ? +# How to inflate multiple flat files ? - Use `inflate_all()` @@ -239,7 +241,9 @@ The code and tests for the second function #' @examples #' my_fun_rdname1(2:20) my_fun_rdname1 <- function(x, na.rm = TRUE) { - if (!is.numeric(x)) {stop("x should be numeric")} + if (!is.numeric(x)) { + stop("x should be numeric") + } stats::median(x, na.rm = na.rm) } ``` @@ -260,7 +264,9 @@ my_fun_rdname1 <- function(x, na.rm = TRUE) { #' @examples #' my_fun_rdname2(2:20) my_fun_rdname2 <- function(x, na.rm = TRUE) { - if (!is.numeric(x)) {stop("x should be numeric")} + if (!is.numeric(x)) { + stop("x should be numeric") + } stats::median(x, na.rm = na.rm) } ``` @@ -289,7 +295,9 @@ This code line is removed in the resulting "R/" files to avoid any interference #' @examples #' my_fun_filename1(2:20) my_fun_filename1 <- function(x, na.rm = TRUE) { - if (!is.numeric(x)) {stop("x should be numeric")} + if (!is.numeric(x)) { + stop("x should be numeric") + } stats::median(x, na.rm = na.rm) } ``` @@ -310,7 +318,9 @@ my_fun_filename1 <- function(x, na.rm = TRUE) { #' @examples #' my_fun_filename2(2:20) my_fun_filename2 <- function(x, na.rm = TRUE) { - if (!is.numeric(x)) {stop("x should be numeric")} + if (!is.numeric(x)) { + stop("x should be numeric") + } stats::median(x, na.rm = na.rm) } ``` @@ -410,3 +420,8 @@ golem::add_module(name = "page1") ``` Although default {golem} "dev/" files already contain the main actions to maintain your package, you can still add the "0-dev_history.Rmd" file recommended with {fusen} using `add_dev_history()`. Note that some sections will be redundant with the {golem} dev files. + +# How can I know if R files were created from a flat or not ? + +You can draw the structure of your package with `fusen:::draw_the_tree(). +Read vignette "Draw a tree of your package files and functions"" for more details. \ No newline at end of file From 2de9db2ceed32006de1befba1b46bc6e95251664 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 14:20:08 +0200 Subject: [PATCH 3/7] doc: update draw tree doc --- README.Rmd | 6 ++++-- README.md | 7 +++++-- dev/dev_history_cran.R | 2 +- inst/the-dev-history.Rmd | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.Rmd b/README.Rmd index 05619f59..20a83f30 100644 --- a/README.Rmd +++ b/README.Rmd @@ -139,10 +139,12 @@ _Note that the `"flat*.Rmd"` files created with templates `full` and `teaching` There is a dedicated vignette to answer this: https://thinkr-open.github.io/fusen/articles/Maintain-packages-with-fusen.html -- **Option 1**: After a first inflate of your flat file, you can continue developing in the "flat_template.Rmd" file, and then inflate it using `fusen::inflat_all()` +- **Option 1**: After a first inflate of your flat file, you can continue developing in the "flat_template.Rmd" file, and then inflate it using `fusen::inflate_all()` - **Option 2**: After you're done with inflating, you can decide to deprecate your flat file with `fusen::deprecate_flat_file()` and develop in the package files directly, as for any other R package. 'fusen' has no impact on the structure of a classical package once inflated. -> Advice : Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place +> Advice: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place + +> Advice: Show the package structure with `fusen::draw_the_tree()` in a "dev/Readme.md" file to help developers ## Who is {fusen} for? diff --git a/README.md b/README.md index 7ce41566..a604cdd1 100644 --- a/README.md +++ b/README.md @@ -180,16 +180,19 @@ There is a dedicated vignette to answer this: - **Option 1**: After a first inflate of your flat file, you can continue developing in the “flat\_template.Rmd” file, and then - inflate it using `fusen::inflat_all()` + inflate it using `fusen::inflate_all()` - **Option 2**: After you’re done with inflating, you can decide to deprecate your flat file with `fusen::deprecate_flat_file()` and develop in the package files directly, as for any other R package. ‘fusen’ has no impact on the structure of a classical package once inflated. -> Advice : Use git as soon as possible, this will avoid losing your work +> Advice: Use git as soon as possible, this will avoid losing your work > if you made some modifications in the wrong place +> Advice: Show the package structure with `fusen::draw_the_tree()` in a +> “dev/Readme.md” file to help developers + ## Who is {fusen} for? If you mind about documentation for your users and tests for your diff --git a/dev/dev_history_cran.R b/dev/dev_history_cran.R index d24eebac..89c9efbf 100644 --- a/dev/dev_history_cran.R +++ b/dev/dev_history_cran.R @@ -54,7 +54,7 @@ Sys.setenv("FUSEN_TEST_PUBLISH" = "FALSE") #> rig run devtools::check() -# Update the map of the package +# Update the tree structure of the package fusen::draw_the_tree() rmarkdown::render("dev/README.Rmd", diff --git a/inst/the-dev-history.Rmd b/inst/the-dev-history.Rmd index 628b333c..869193d7 100644 --- a/inst/the-dev-history.Rmd +++ b/inst/the-dev-history.Rmd @@ -59,6 +59,8 @@ usethis::use_readme_rmd() usethis::use_code_of_conduct("contact@fake.com") # NEWS usethis::use_news_md() +# Package structure (add this in a dev/Readme.md file) +fusen::draw_the_tree() ``` **From now, you will need to "inflate" your package at least once to be able to use the following commands. Let's go to your flat template, and come back here later if/when needed.** From 0000e8cb86c83f400f59622d1681cd572372e675 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 14:32:30 +0200 Subject: [PATCH 4/7] refactor: rename draw_package_structure --- NAMESPACE | 2 +- NEWS.md | 2 +- R/get_package_structure.R | 8 ++++---- README.Rmd | 2 +- README.md | 5 +++-- dev/README.Rmd | 2 +- dev/README.md | 4 ++-- dev/dev_history_cran.R | 6 +++++- dev/flat_get_package_structure.Rmd | 12 ++++++------ inst/the-dev-history.Rmd | 2 +- man/get_package_structure.Rd | 10 +++++----- tests/testthat/_snaps/get_package_structure.md | 4 ++-- tests/testthat/test-get_package_structure.R | 4 ++-- vignettes/Maintain-packages-with-fusen.Rmd | 2 +- ...aw-a-tree-of-your-package-files-and-functions.Rmd | 6 +++--- vignettes/tips-and-tricks.Rmd | 2 +- 16 files changed, 39 insertions(+), 34 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 04476196..7f8af919 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,7 +11,7 @@ export(add_minimal_package) export(check_not_registered_files) export(create_fusen) export(deprecate_flat_file) -export(draw_the_tree) +export(draw_package_structure) export(fill_description) export(get_all_created_funs) export(get_package_structure) diff --git a/NEWS.md b/NEWS.md index a5e0058d..58cf0a01 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,7 @@ ## New features -- `draw_the_tree()` along with `get_package_structure()` allows to draw the package structure with +- `draw_package_structure()` along with `get_package_structure()` allows to draw the package structure with all functions created in each R file, and whether they are exported (#189) - `rename_flat_file()` allows to rename a flat file, and deals with config and inflated files - `deprecate_flat_file()` helps properly deprecate a flat file, modifies the config file diff --git a/R/get_package_structure.R b/R/get_package_structure.R index d79efec9..3a8eee0b 100644 --- a/R/get_package_structure.R +++ b/R/get_package_structure.R @@ -14,7 +14,7 @@ #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() -#' draw_the_tree(pkg_structure) +#' draw_package_structure(pkg_structure) #' } #' #' # Example with a dummy package @@ -36,7 +36,7 @@ #' #' # Works with classical package #' pkg_structure <- get_package_structure() -#' draw_the_tree(pkg_structure) +#' draw_package_structure(pkg_structure) #' }) #' #' usethis::with_project(dummypackage, { @@ -50,7 +50,7 @@ #' ) #' #' pkg_structure <- get_package_structure() -#' draw_the_tree(pkg_structure) +#' draw_package_structure(pkg_structure) #' }) get_package_structure <- function( config_file, @@ -164,7 +164,7 @@ get_package_structure <- function( #' @export #' @rdname get_package_structure #' -draw_the_tree <- function(structure_list, silent = FALSE) { +draw_package_structure <- function(structure_list, silent = FALSE) { if (missing(structure_list)) { structure_list <- get_package_structure(silent = silent) } diff --git a/README.Rmd b/README.Rmd index 20a83f30..7e9ca2cb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -144,7 +144,7 @@ There is a dedicated vignette to answer this: https://thinkr-open.github.io/fuse > Advice: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place -> Advice: Show the package structure with `fusen::draw_the_tree()` in a "dev/Readme.md" file to help developers +> Advice: Show the package structure with `fusen::draw_package_structure()` in a "dev/Readme.md" file to help developers ## Who is {fusen} for? diff --git a/README.md b/README.md index a604cdd1..5ba91969 100644 --- a/README.md +++ b/README.md @@ -190,8 +190,9 @@ There is a dedicated vignette to answer this: > Advice: Use git as soon as possible, this will avoid losing your work > if you made some modifications in the wrong place -> Advice: Show the package structure with `fusen::draw_the_tree()` in a -> “dev/Readme.md” file to help developers +> Advice: Show the package structure with +> `fusen::draw_package_structure()` in a “dev/Readme.md” file to help +> developers ## Who is {fusen} for? diff --git a/dev/README.Rmd b/dev/README.Rmd index 69fb6d6c..c25646e3 100644 --- a/dev/README.Rmd +++ b/dev/README.Rmd @@ -10,6 +10,6 @@ The _keep_ section is for independent files, which were not issued from a flat f pkgload::load_all() usethis::with_project(here::here(), { - fusen::draw_the_tree(silent = TRUE) + fusen::draw_package_structure(silent = TRUE) }) ``` diff --git a/dev/README.md b/dev/README.md index 9a3d582f..1f891f0d 100644 --- a/dev/README.md +++ b/dev/README.md @@ -8,7 +8,7 @@ a flat file. pkgload::load_all() usethis::with_project(here::here(), { - fusen::draw_the_tree(silent = TRUE) + fusen::draw_package_structure(silent = TRUE) }) ``` @@ -74,7 +74,7 @@ usethis::with_project(here::here(), { - 👀 get\_all\_created\_funs - R/get\_package\_structure.R - 👀 get\_package\_structure - - 👀 draw\_the\_tree + - 👀 draw\_package\_structure - tests - tests/testthat/test-get\_package\_structure.R - tests/testthat/test-get\_all\_created\_funs.R diff --git a/dev/dev_history_cran.R b/dev/dev_history_cran.R index 89c9efbf..350fd5e2 100644 --- a/dev/dev_history_cran.R +++ b/dev/dev_history_cran.R @@ -53,13 +53,17 @@ Sys.setenv("FUSEN_TEST_PUBLISH" = "FALSE") # Run with r-devel using {rig} #> rig run devtools::check() +suppressMessages(devtools::test()) # interactivity # Update the tree structure of the package -fusen::draw_the_tree() +fusen::draw_package_structure() rmarkdown::render("dev/README.Rmd", output_format = "github_document", output_file = "README.md" ) +rmarkdown::render("README.Rmd", + output_format = "github_document", output_file = "README.md" +) # > Copy from Prepare-for-cran - https://github.com/ThinkR-open/prepare-for-cran ==================== diff --git a/dev/flat_get_package_structure.Rmd b/dev/flat_get_package_structure.Rmd index 1a307e02..32198579 100644 --- a/dev/flat_get_package_structure.Rmd +++ b/dev/flat_get_package_structure.Rmd @@ -154,7 +154,7 @@ get_package_structure <- function( #' @export #' @rdname get_package_structure #' -draw_the_tree <- function(structure_list, silent = FALSE) { +draw_package_structure <- function(structure_list, silent = FALSE) { if (missing(structure_list)) { structure_list <- get_package_structure(silent = silent) } @@ -215,7 +215,7 @@ draw_the_tree <- function(structure_list, silent = FALSE) { #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() -#' draw_the_tree(pkg_structure) +#' draw_package_structure(pkg_structure) #' } #' #' # Example with a dummy package @@ -237,7 +237,7 @@ usethis::with_project(dummypackage, { # Works with classical package pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) usethis::with_project(dummypackage, { @@ -251,7 +251,7 @@ usethis::with_project(dummypackage, { ) pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) ``` @@ -276,7 +276,7 @@ usethis::with_project(dummypackage, { pkg_structure <- get_package_structure() expect_snapshot(pkg_structure) - expect_snapshot(draw_the_tree(pkg_structure)) + expect_snapshot(draw_package_structure(pkg_structure)) }) @@ -307,7 +307,7 @@ usethis::with_project(dummypackage, { expect_snapshot(pkg_structure) - expect_snapshot(draw_the_tree(pkg_structure)) + expect_snapshot(draw_package_structure(pkg_structure)) }) }) ``` diff --git a/inst/the-dev-history.Rmd b/inst/the-dev-history.Rmd index 869193d7..142b71e5 100644 --- a/inst/the-dev-history.Rmd +++ b/inst/the-dev-history.Rmd @@ -60,7 +60,7 @@ usethis::use_code_of_conduct("contact@fake.com") # NEWS usethis::use_news_md() # Package structure (add this in a dev/Readme.md file) -fusen::draw_the_tree() +fusen::draw_package_structure() ``` **From now, you will need to "inflate" your package at least once to be able to use the following commands. Let's go to your flat template, and come back here later if/when needed.** diff --git a/man/get_package_structure.Rd b/man/get_package_structure.Rd index a0af4475..839d2da1 100644 --- a/man/get_package_structure.Rd +++ b/man/get_package_structure.Rd @@ -2,12 +2,12 @@ % Please edit documentation in R/get_package_structure.R \name{get_package_structure} \alias{get_package_structure} -\alias{draw_the_tree} +\alias{draw_package_structure} \title{Get structure and information of a 'fusen' built package for developers} \usage{ get_package_structure(config_file, emoji = TRUE, silent = FALSE) -draw_the_tree(structure_list, silent = FALSE) +draw_package_structure(structure_list, silent = FALSE) } \arguments{ \item{config_file}{Path to a source configuration file @@ -32,7 +32,7 @@ Draw a tree of the package structure in the console \dontrun{ # This only works inside a 'fusen' built package pkg_structure <- get_package_structure() -draw_the_tree(pkg_structure) +draw_package_structure(pkg_structure) } # Example with a dummy package @@ -54,7 +54,7 @@ usethis::with_project(dummypackage, { # Works with classical package pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) usethis::with_project(dummypackage, { @@ -68,6 +68,6 @@ usethis::with_project(dummypackage, { ) pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) } diff --git a/tests/testthat/_snaps/get_package_structure.md b/tests/testthat/_snaps/get_package_structure.md index 5a76f90c..518d8a7b 100644 --- a/tests/testthat/_snaps/get_package_structure.md +++ b/tests/testthat/_snaps/get_package_structure.md @@ -26,7 +26,7 @@ --- Code - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) Output - keep @@ -93,7 +93,7 @@ --- Code - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) Output - flat_full.Rmd diff --git a/tests/testthat/test-get_package_structure.R b/tests/testthat/test-get_package_structure.R index 8bab65e5..c7f56720 100644 --- a/tests/testthat/test-get_package_structure.R +++ b/tests/testthat/test-get_package_structure.R @@ -20,7 +20,7 @@ usethis::with_project(dummypackage, { pkg_structure <- get_package_structure() expect_snapshot(pkg_structure) - expect_snapshot(draw_the_tree(pkg_structure)) + expect_snapshot(draw_package_structure(pkg_structure)) }) @@ -51,6 +51,6 @@ usethis::with_project(dummypackage, { expect_snapshot(pkg_structure) - expect_snapshot(draw_the_tree(pkg_structure)) + expect_snapshot(draw_package_structure(pkg_structure)) }) }) diff --git a/vignettes/Maintain-packages-with-fusen.Rmd b/vignettes/Maintain-packages-with-fusen.Rmd index 5195aae7..ed15890e 100644 --- a/vignettes/Maintain-packages-with-fusen.Rmd +++ b/vignettes/Maintain-packages-with-fusen.Rmd @@ -56,7 +56,7 @@ Your first `inflate()` may not directly work as expected as with any R code that > Advice 2: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place -> Advice 3: Create a Readme.Rmd in the "dev/" directory with a chunk having `fusen::draw_the_tree()` and knit it. This will help to understand the structure of your package and see what is inflated or not. Have a look at the {fusen} package itself on GitHub to see how it looks like. +> Advice 3: Create a Readme.Rmd in the "dev/" directory with a chunk having `fusen::draw_package_structure()` and knit it. This will help to understand the structure of your package and see what is inflated or not. Have a look at the {fusen} package itself on GitHub to see how it looks like. ## Option 1: Continue with the "flat_template.Rmd" diff --git a/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd index 3bddba12..a696cdb8 100644 --- a/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd +++ b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd @@ -45,7 +45,7 @@ With `draw_the_map()`, you can draw a tree of the package structure in the conso #' \dontrun{ #' # This only works inside a 'fusen' built package #' pkg_structure <- get_package_structure() -#' draw_the_tree(pkg_structure) +#' draw_package_structure(pkg_structure) #' } #' #' # Example with a dummy package @@ -67,7 +67,7 @@ usethis::with_project(dummypackage, { # Works with classical package pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) usethis::with_project(dummypackage, { @@ -81,7 +81,7 @@ usethis::with_project(dummypackage, { ) pkg_structure <- get_package_structure() - draw_the_tree(pkg_structure) + draw_package_structure(pkg_structure) }) ``` diff --git a/vignettes/tips-and-tricks.Rmd b/vignettes/tips-and-tricks.Rmd index e9c0a412..d97fa890 100644 --- a/vignettes/tips-and-tricks.Rmd +++ b/vignettes/tips-and-tricks.Rmd @@ -423,5 +423,5 @@ Although default {golem} "dev/" files already contain the main actions to mainta # How can I know if R files were created from a flat or not ? -You can draw the structure of your package with `fusen:::draw_the_tree(). +You can draw the structure of your package with `fusen:::draw_package_structure(). Read vignette "Draw a tree of your package files and functions"" for more details. \ No newline at end of file From 5b4f5fc48594b475a389cd399abc9976d8532d2d Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 15:06:11 +0200 Subject: [PATCH 5/7] chore: modify email --- .github/workflows/rhub.yaml | 36 +++++++++++++++++++++++++---------- DESCRIPTION | 2 +- dev/cran-comments-history.md | 9 +++++++++ dev/dev_history_cran.R | 37 ++++++------------------------------ 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/rhub.yaml b/.github/workflows/rhub.yaml index 48b12a46..74ec7b05 100644 --- a/.github/workflows/rhub.yaml +++ b/.github/workflows/rhub.yaml @@ -1,13 +1,13 @@ -# R-hub's genetic GitHub Actions workflow file. It's canonical location is at -# https://github.com/r-hub/rhub2/blob/v1/inst/workflow/rhub.yaml +# R-hub's generic GitHub Actions workflow file. It's canonical location is at +# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml # You can update this file to a newer version using the rhub2 package: # -# rhub2::rhub_setup() +# rhub::rhub_setup() # # It is unlikely that you need to modify this file manually. name: R-hub -run-name: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }} (${{ github.event.inputs.id }}) +run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}" on: workflow_dispatch: @@ -33,7 +33,7 @@ jobs: steps: # NO NEED TO CHECKOUT HERE - - uses: r-hub/rhub2/actions/rhub-setup@v1 + - uses: r-hub/actions/setup@v1 with: config: ${{ github.event.inputs.config }} id: rhub-setup @@ -51,8 +51,16 @@ jobs: image: ${{ matrix.config.container }} steps: - - uses: actions/checkout@v3 - - uses: r-hub/rhub2/actions/rhub-check@v1 + - uses: r-hub/actions/checkout@v1 + - uses: r-hub/actions/platform-info@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/setup-deps@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/run-check@v1 with: token: ${{ secrets.RHUB_TOKEN }} job-config: ${{ matrix.config.job-config }} @@ -68,12 +76,20 @@ jobs: config: ${{ fromJson(needs.setup.outputs.platforms) }} steps: - - uses: actions/checkout@v3 - - uses: r-hub/rhub2/actions/rhub-setup-r@v1 + - uses: r-hub/actions/checkout@v1 + - uses: r-hub/actions/setup-r@v1 + with: + job-config: ${{ matrix.config.job-config }} + token: ${{ secrets.RHUB_TOKEN }} + - uses: r-hub/actions/platform-info@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/setup-deps@v1 with: job-config: ${{ matrix.config.job-config }} token: ${{ secrets.RHUB_TOKEN }} - - uses: r-hub/rhub2/actions/rhub-check@v1 + - uses: r-hub/actions/run-check@v1 with: job-config: ${{ matrix.config.job-config }} token: ${{ secrets.RHUB_TOKEN }} diff --git a/DESCRIPTION b/DESCRIPTION index 80351b77..0a7efdfb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: fusen Title: Build a Package from Rmarkdown Files Version: 0.6.0 Authors@R: c( - person("Sebastien", "Rochette", , "sebastien@thinkr.fr", role = c("aut", "cre"), + person("Sebastien", "Rochette", , "sebastienrochettefr@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-1565-9313")), person("ThinkR", role = "cph") ) diff --git a/dev/cran-comments-history.md b/dev/cran-comments-history.md index 9f906612..d48e96de 100644 --- a/dev/cran-comments-history.md +++ b/dev/cran-comments-history.md @@ -1,3 +1,12 @@ +# v0.6.0 +## R CMD check results + +0 errors | 0 warnings | 1 note + +* Maintainer email was changed for my personal address, instead of my professional one. +* OK on GitHub Actions, rhub, winbuilder and macbuilder + + # v0.5.2 ## R CMD check results diff --git a/dev/dev_history_cran.R b/dev/dev_history_cran.R index 350fd5e2..5b27d3ff 100644 --- a/dev/dev_history_cran.R +++ b/dev/dev_history_cran.R @@ -58,9 +58,11 @@ suppressMessages(devtools::test()) # interactivity # Update the tree structure of the package fusen::draw_package_structure() +# Update Readmes rmarkdown::render("dev/README.Rmd", output_format = "github_document", output_file = "README.md" ) + rmarkdown::render("README.Rmd", output_format = "github_document", output_file = "README.md" ) @@ -115,37 +117,10 @@ urlchecker::url_update() # check on other distributions # _rhub -devtools::check_rhub() -# List all R-hub platforms: -rhub::platforms() -buildpath <- devtools::build() -rhub::check_on_windows( - check_args = "--force-multiarch", - show_status = FALSE, - path = buildpath -) -rhub::check_on_solaris(show_status = FALSE, path = buildpath) -rhub::check( - platform = "debian-clang-devel", - show_status = FALSE, - path = buildpath -) -rhub::check( - platform = "debian-gcc-devel", - show_status = FALSE, - path = buildpath -) -rhub::check( - platform = "fedora-clang-devel", - show_status = FALSE, - path = buildpath -) -rhub::check( - platform = "macos-highsierra-release-cran", - show_status = FALSE, - path = buildpath -) -rhub::check_for_cran(show_status = FALSE, path = buildpath) +rhub::rhub_setup(overwrite = TRUE) +rhub::rhub_doctor() +rhub::rhub_platforms() +rhub::rhub_check() # _win devel CRAN devtools::check_win_devel() From f75d99d9f79fbb1ad678d5e7f8b0616eadf721c0 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 15:08:44 +0200 Subject: [PATCH 6/7] doc: update info for tree structure --- dev/flat_get_package_structure.Rmd | 3 ++- man/fusen-package.Rd | 2 +- vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/flat_get_package_structure.Rmd b/dev/flat_get_package_structure.Rmd index 32198579..ba70db98 100644 --- a/dev/flat_get_package_structure.Rmd +++ b/dev/flat_get_package_structure.Rmd @@ -28,7 +28,8 @@ You can know: - There is a possibility to list all functions that are called in the test files - The vignette issued from the flat file -With `draw_the_map()`, you can draw a tree of the package structure in the console. +With `draw_package_structure()`, you can draw a tree of the package structure in the console. +This also works for any R package, not only for `fusen` built packages. ```{r function-get_package_structure} #' Get structure and information of a 'fusen' built package for developers diff --git a/man/fusen-package.Rd b/man/fusen-package.Rd index 57a0706b..c704d986 100644 --- a/man/fusen-package.Rd +++ b/man/fusen-package.Rd @@ -19,7 +19,7 @@ Useful links: } \author{ -\strong{Maintainer}: Sebastien Rochette \email{sebastien@thinkr.fr} (\href{https://orcid.org/0000-0002-1565-9313}{ORCID}) +\strong{Maintainer}: Sebastien Rochette \email{sebastienrochettefr@gmail.com} (\href{https://orcid.org/0000-0002-1565-9313}{ORCID}) Other contributors: \itemize{ diff --git a/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd index a696cdb8..d834dc57 100644 --- a/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd +++ b/vignettes/draw-a-tree-of-your-package-files-and-functions.Rmd @@ -37,7 +37,8 @@ You can know: - There is a possibility to list all functions that are called in the test files - The vignette issued from the flat file -With `draw_the_map()`, you can draw a tree of the package structure in the console. +With `draw_package_structure()`, you can draw a tree of the package structure in the console. +This also works for any R package, not only for `fusen` built packages. ```{r examples-get_package_structure} #| eval: yes From 5d3c888905587c5bb65fc4c7d9a1ffdfae089bf7 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Mon, 13 May 2024 15:23:33 +0200 Subject: [PATCH 7/7] ci: remove check on R3.6 --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2c904315..d997c129 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,7 +23,7 @@ jobs: - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} - - {os: ubuntu-20.04, r: '3.6'} + # - {os: ubuntu-20.04, r: '3.6'} # - {os: ubuntu-20.04, r: '3.5'} # with usethis >2.2 env: