diff --git a/.github/workflows/R-CMD-check-devel.yaml b/.github/workflows/R-CMD-check-devel.yaml index c8c5e69d..09fd8192 100644 --- a/.github/workflows/R-CMD-check-devel.yaml +++ b/.github/workflows/R-CMD-check-devel.yaml @@ -54,19 +54,6 @@ jobs: remotes::install_github("ThinkR-open/lightparser", upgrade = "always") shell: Rscript {0} - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - name: Setup tmate session uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} # Works on 'main' only diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d997c129..e3a8c0a4 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -2,7 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, production-cran] + branches: [main, master, production-cran, main-268-test_x86] pull_request: branches: [main, master, production-cran] @@ -23,6 +23,7 @@ jobs: - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: macos-13, r: 'release'} #x86_64 # - {os: ubuntu-20.04, r: '3.6'} # - {os: ubuntu-20.04, r: '3.5'} # with usethis >2.2 diff --git a/DESCRIPTION b/DESCRIPTION index 0c629498..3b3288af 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,12 @@ Package: fusen Title: Build a Package from Rmarkdown Files -Version: 0.6.0.9004 +Version: 0.7.1 Authors@R: c( - person("Sebastien", "Rochette", , "sebastienrochettefr@gmail.com", role = c("aut", "cre"), - comment = c(ORCID = "0000-0002-1565-9313")), - person("Yohann", "Mansiaux", , "yohann.mansiaux@gmail.com.com", role = "aut"), + person("Sebastien", "Rochette", , "sebastienrochettefr@gmail.com", role = "aut", + comment = c(ORCID = "0000-0002-1565-9313", "creator")), + person("Vincent", "Guyader", , "vincent@thinkr.fr", role = c("aut", "cre"), + comment = c(ORCID = "0000-0003-0671-9270")), + person("Yohann", "Mansiaux", , "yohann.mansiaux@gmail.com", role = "aut"), person("ThinkR", role = "cph") ) Description: Use Rmarkdown First method to build your package. Start your @@ -50,7 +52,7 @@ Suggests: withr VignetteBuilder: knitr -Config/fusen/version: 0.6.0.9004 +Config/fusen/version: 0.7.0 Config/testthat/edition: 3 Config/testthat/parallel: false Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index 14a2c4a2..a4471d1a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,21 +1,24 @@ -# fusen (development version 0.6.0.9003) +# fusen 0.7.1 -## New features +## Bug fix -- `inflate` and `inflate_all()` proposes to compute the package code coverage using `covr::package_coverage()` using the `codecov` parameter (default is FALSE) +- Skip some tests on MacOS on CRAN to avoid errors -# fusen (development version 0.6.0.9002) +# fusen 0.7.0 ## New features +- Adding `sepuku()`, allowing to remove all traces of a fusen-related files and tags in the package (#257 #258 #259) @ymansiaux +- `inflate` and `inflate_all()` proposes to compute the package code coverage using `covr::package_coverage()` using the `codecov` parameter (default is FALSE) - RStudio Addin "Fusen : Add fusen chunks" as well as `fusen::add_fusen_chunks()` add a development chunk in complement to the "function", "example" and "test" chunks already provided (#255) @ymansiaux +## Minor changes -# fusen (development version 0.6.0.9001) +- Add `# nolint: line_length_linter` in created files to avoid line length linter warnings (#278) @LBeaulaton -## New features +## Bug fixes -- Adding `sepuku()`, allowing to remove all traces of a fusen-related files and tags in the package (#257 #258 #259) @ymansiaux +- Fix `grep()` calls in unit tests (#271) @statnmap # fusen 0.6.0 diff --git a/R/add_flat_template.R b/R/add_flat_template.R index fbba4903..4a0a3720 100644 --- a/R/add_flat_template.R +++ b/R/add_flat_template.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_create_flat.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_create_flat.Rmd: do not edit by hand # nolint: line_length_linter. #' @rdname add_flat_template #' @export diff --git a/R/build_fusen_chunks.R b/R/build_fusen_chunks.R index e7b107b7..8acfecd6 100644 --- a/R/build_fusen_chunks.R +++ b/R/build_fusen_chunks.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_addins.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_addins.Rmd: do not edit by hand # nolint: line_length_linter. #' Add 'fusen' chunks #' diff --git a/R/deprecate_flat_file.R b/R/deprecate_flat_file.R index ce46a564..3cde99cb 100644 --- a/R/deprecate_flat_file.R +++ b/R/deprecate_flat_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand # nolint: line_length_linter. #' Deprecate a flat file #' diff --git a/R/get_all_created_funs.R b/R/get_all_created_funs.R index ee3a2140..b804b09e 100644 --- a/R/get_all_created_funs.R +++ b/R/get_all_created_funs.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand # nolint: line_length_linter. #' Get all functions created in a R file #' diff --git a/R/get_package_structure.R b/R/get_package_structure.R index e4f634a0..2a2bb201 100644 --- a/R/get_package_structure.R +++ b/R/get_package_structure.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand # nolint: line_length_linter. #' Get structure and information of a 'fusen' built package for developers #' diff --git a/R/inflate-utils.R b/R/inflate-utils.R index a039cffb..7b5d09f6 100644 --- a/R/inflate-utils.R +++ b/R/inflate-utils.R @@ -284,7 +284,7 @@ parse_test <- function(x, pkg, relative_flat_file) { # x <- rmd_test[1,] } lines <- c( - sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand\n", relative_flat_file), + sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand # nolint: line_length_linter.\n", relative_flat_file), x[["code"]][[1]] ) write_utf8(path = test_file, lines = lines) diff --git a/R/inflate.R b/R/inflate.R index 98963d85..a5f0922f 100644 --- a/R/inflate.R +++ b/R/inflate.R @@ -547,7 +547,7 @@ create_r_files <- function(fun_code, pkg, relative_flat_file) { cli::cli_alert_warning(paste(basename(r_file), "has been overwritten")) } lines <- c( - sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand\n", relative_flat_file), + sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand # nolint: line_length_linter.\n", relative_flat_file), unlist(fun_code[x, ][["code_example"]]) ) write_utf8(path = r_file, lines = lines) diff --git a/R/inflate_all.R b/R/inflate_all.R index d0b21f11..3addb6cc 100644 --- a/R/inflate_all.R +++ b/R/inflate_all.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all.Rmd: do not edit by hand # nolint: line_length_linter. #' Inflate all your flat files #' diff --git a/R/inflate_all_utils.R b/R/inflate_all_utils.R index a71d6498..0dcd0de3 100644 --- a/R/inflate_all_utils.R +++ b/R/inflate_all_utils.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand # nolint: line_length_linter. #' This function evaluates whether flat files can or can not be inflated with `inflate_all()` #' diff --git a/R/init_share_on_github.R b/R/init_share_on_github.R index b570cebb..ab31454a 100644 --- a/R/init_share_on_github.R +++ b/R/init_share_on_github.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_init_share_on_github.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_init_share_on_github.Rmd: do not edit by hand # nolint: line_length_linter. #' Initiate GitHub to share your package on a website #' diff --git a/R/pre_inflate_all_diagnosis_eval.R b/R/pre_inflate_all_diagnosis_eval.R index e956bb95..9cf9d892 100644 --- a/R/pre_inflate_all_diagnosis_eval.R +++ b/R/pre_inflate_all_diagnosis_eval.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand # nolint: line_length_linter. #' Eval message, warning and error from the diagnostic table #' diff --git a/R/register_config_file.R b/R/register_config_file.R index ec6e7818..5cc25d37 100644 --- a/R/register_config_file.R +++ b/R/register_config_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_register_config_file.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_register_config_file.Rmd: do not edit by hand # nolint: line_length_linter. #' Show in a table files that are not already registered in the yaml config file #' diff --git a/R/rename_flat_file.R b/R/rename_flat_file.R index ed7762bc..acf4a331 100644 --- a/R/rename_flat_file.R +++ b/R/rename_flat_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand # nolint: line_length_linter. #' Rename a flat file #' diff --git a/R/sepuku.R b/R/sepuku.R index d12ca8b7..6d639ba5 100644 --- a/R/sepuku.R +++ b/R/sepuku.R @@ -1,8 +1,8 @@ -# WARNING - Generated by {fusen} from dev/flat_sepuku.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_sepuku.Rmd: do not edit by hand # nolint: line_length_linter. #' Clean a package from fusen-related files and tags #' -#' This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. +#' This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as Rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. #' #' @param pkg Character. Path of the current package #' @param force logical. whether to force the cleaning or not, without asking if the user is sure about making this operation (default: FALSE) @@ -127,9 +127,9 @@ sepuku <- function( config_file <- getOption("fusen.config_file", default = "dev/config_fusen.yaml") if (!file.exists(config_file)) { - cli_alert_info("No fusen configuration file found. The flat files to be deleted will be identified as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders.") + cli_alert_info("No fusen configuration file found. The flat files to be deleted will be identified as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders.") } else { - cli_alert_info("A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted.") + cli_alert_info("A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted.") } flat_files <- list_flat_files(pkg = pkg) diff --git a/R/sepuku_utils.R b/R/sepuku_utils.R index e6274344..0d35f57d 100644 --- a/R/sepuku_utils.R +++ b/R/sepuku_utils.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_sepuku-utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_sepuku-utils.Rmd: do not edit by hand # nolint: line_length_linter. #' @importFrom yaml read_yaml #' @noRd @@ -49,7 +49,7 @@ list_flat_files_in_dev_folder <- function( #' List all flat files present in the package #' -#' Search for flat files listed in fusen config file, and for rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder +#' Search for flat files listed in fusen config file, and for Rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder #' #' @param pkg Path to package #' @return a vector of flat files paths diff --git a/README.Rmd b/README.Rmd index 7e9ca2cb..bcba677e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -140,7 +140,7 @@ _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::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. +- **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. You can even use `sepuku()` to remove all traces of 'fusen'. > Advice: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place @@ -175,6 +175,7 @@ Write them all in the same file while you explore the possibilities and let {fus - 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 ? +- How can I get rid of everything related to 'fusen' in my package ? => 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 de198fca..0f4fae0b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ - [![fusen status @@ -174,7 +173,7 @@ There is a dedicated vignette to answer this: 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. + inflated. You can even use `sepuku()` to remove all traces of ‘fusen’. > Advice: Use git as soon as possible, this will avoid losing your work > if you made some modifications in the wrong place @@ -233,6 +232,7 @@ place. - 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 ? +- How can I get rid of everything related to ‘fusen’ in my package ? =\> See vignette Tips and Tricks: @@ -250,12 +250,9 @@ in a specific way so that at the end, you can magically `inflate()` it to let a nice package appear.
- - Click here to fold your {fusen}… -
diff --git a/dev/cran-comments-history.md b/dev/cran-comments-history.md index d48e96de..4104bc88 100644 --- a/dev/cran-comments-history.md +++ b/dev/cran-comments-history.md @@ -1,3 +1,26 @@ +# v0.7.1 +## R CMD check results + +A new error appeared on CRAN for x86-64 MacOS architecture after the release of v0.7.0 +The present release fixes the problem + +0 errors | 0 warnings | 0 note + +* OK on GitHub Actions, rhub, winbuilder and macbuilder +* Fixes error on CRAN checks: "DESCRIPTION file does not exist" + +# v0.7.0 +## R CMD check results + +0 errors | 0 warnings | 1 note + +* Maintainer was changed for Vincent Guyader, instead Sébastien Rochette. +* OK on GitHub Actions, rhub, winbuilder and macbuilder +* Fixes error on CRAN checks: "invalid regular expression" + + + + # v0.6.0 ## R CMD check results @@ -5,7 +28,7 @@ * Maintainer email was changed for my personal address, instead of my professional one. * OK on GitHub Actions, rhub, winbuilder and macbuilder - +* Fixes notes on CRAN checks: "Lost braces; missing escapes or markup?" # v0.5.2 ## R CMD check results diff --git a/dev/flat_create_flat.Rmd b/dev/flat_create_flat.Rmd index 1a14af1c..367b1cdd 100644 --- a/dev/flat_create_flat.Rmd +++ b/dev/flat_create_flat.Rmd @@ -4,7 +4,7 @@ output: html_document editor_options: chunk_output_type: console inflate: - state: deprecated? + state: active --- ```{r development, include=FALSE} @@ -632,6 +632,7 @@ for (template in all_templates) { expect_true(sum(grepl(paste0("fusen::inflate\\(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\""), flat_lines)) == 1) withr::with_dir(dummypackage4, { + skip_on_os(os = "mac", arch = "x86_64") inflate_command <- paste0("fusen::inflate(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\", open_vignette = FALSE, check = FALSE)") expect_error(suppressMessages(eval(parse(text = inflate_command))), regexp = NA) }) @@ -640,6 +641,7 @@ for (template in all_templates) { # Now try to inflates a second time test_that("flat file inflates a second time", { withr::with_dir(dummypackage4, { + skip_on_os(os = "mac", arch = "x86_64") inflate_command_second <- paste0("fusen::inflate(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\", open_vignette = FALSE, check = FALSE, overwrite = TRUE)") expect_error(suppressMessages(eval(parse(text = inflate_command_second))), regexp = NA) }) diff --git a/dev/flat_deal_with_flat_files.Rmd b/dev/flat_deal_with_flat_files.Rmd index cc0b68c6..75b68972 100644 --- a/dev/flat_deal_with_flat_files.Rmd +++ b/dev/flat_deal_with_flat_files.Rmd @@ -348,7 +348,7 @@ usethis::with_project(dummypackage, { ## Fully deprecate a flat file after inflate -'fusen' serves as a framework to ensure that developers prioritize end-users during the function development process. By employing 'fusen' within Rmd/Qmd files, developers can conceptualize their product and articulate their ideas in plain text before initiating any code. This approach encourages consideration of the package's users: their intended actions, and the potential impact on their experiences. Consequently, developers can draft function documentation prior to its implementation, thinking about explaining what's behind the black box, as well as reminding that this may end into the vignette. +'fusen' serves as a framework to ensure that developers prioritize end-users during the function development process. By employing 'fusen' within Rmd/qmd files, developers can conceptualize their product and articulate their ideas in plain text before initiating any code. This approach encourages consideration of the package's users: their intended actions, and the potential impact on their experiences. Consequently, developers can draft function documentation prior to its implementation, thinking about explaining what's behind the black box, as well as reminding that this may end into the vignette. Additionally, 'fusen' offers a minimal template comprising 'function', 'doc', and 'test' components. We advocate for Test Driven Development (TDD), where writing tests precedes function implementation. This practice aids in function design and enables anticipation of future behavior. diff --git a/dev/flat_sepuku-utils.Rmd b/dev/flat_sepuku-utils.Rmd index e050f784..6d7aa853 100644 --- a/dev/flat_sepuku-utils.Rmd +++ b/dev/flat_sepuku-utils.Rmd @@ -165,7 +165,7 @@ usethis::with_project(dummypackage, { # Add licence usethis::use_mit_license("John Doe") - test_that("list_flat_files_in_dev_folder works for rmd and qmd files in dev folder starting with flat", { + test_that("list_flat_files_in_dev_folder works for Rmd and qmd files in dev folder starting with flat", { flat_file_with_bad_name <- "xxx_flat2.Rmd" file.create(file.path(dummypackage, "dev", flat_file_with_bad_name)) @@ -191,7 +191,7 @@ usethis::with_project(dummypackage, { ) }) - test_that("list_flat_files_in_dev_folder works for rmd and qmd files in flat_history folder starting with flat", { + test_that("list_flat_files_in_dev_folder works for Rmd and qmd files in flat_history folder starting with flat", { inflate( pkg = dummypackage, flat_file = flat_file1, @@ -240,7 +240,7 @@ unlink(dummypackage, recursive = TRUE) ```{r function-list_flat_files} #' List all flat files present in the package #' -#' Search for flat files listed in fusen config file, and for rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder +#' Search for flat files listed in fusen config file, and for Rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder #' #' @param pkg Path to package #' @return a vector of flat files paths diff --git a/dev/flat_sepuku.Rmd b/dev/flat_sepuku.Rmd index 17fcedec..1fc615f2 100644 --- a/dev/flat_sepuku.Rmd +++ b/dev/flat_sepuku.Rmd @@ -16,7 +16,7 @@ pkgload::load_all(export_all = FALSE) # Move from a package developed with fusen to a "classical" package -After a while, you may want to move from a package developed with fusen to a "classical" package. This is possible with the `sepuku()` function. This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. +After a while, you may want to move from a package developed with fusen to a "classical" package. This is possible with the `sepuku()` function. This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as Rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. Switching from a package developed with fusen to a "classical" package might be useful if you want to share your package with someone who is not familiar with fusen or if you want to stop using fusen for any reason. @@ -26,7 +26,7 @@ Please be aware that this operation is irreversible. You will lose all the histo ```{r function-sepuku} #' Clean a package from fusen-related files and tags #' -#' This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. +#' This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as Rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. #' #' @param pkg Character. Path of the current package #' @param force logical. whether to force the cleaning or not, without asking if the user is sure about making this operation (default: FALSE) @@ -46,9 +46,9 @@ sepuku <- function( config_file <- getOption("fusen.config_file", default = "dev/config_fusen.yaml") if (!file.exists(config_file)) { - cli_alert_info("No fusen configuration file found. The flat files to be deleted will be identified as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders.") + cli_alert_info("No fusen configuration file found. The flat files to be deleted will be identified as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders.") } else { - cli_alert_info("A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted.") + cli_alert_info("A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted.") } flat_files <- list_flat_files(pkg = pkg) @@ -275,7 +275,7 @@ usethis::with_project(dummypackage, { dir.create(file.path(dummypackage, "dev")) expect_message( sepuku(force = TRUE), - "No fusen configuration file found. The flat files to be deleted will be identified as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders." + "No fusen configuration file found. The flat files to be deleted will be identified as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders." ) }) @@ -300,7 +300,7 @@ usethis::with_project(dummypackage, { expect_message( sepuku(force = TRUE), - "A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted." + "A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted." ) }) diff --git a/man/fusen-package.Rd b/man/fusen-package.Rd index aabd26f7..8d8bfbf8 100644 --- a/man/fusen-package.Rd +++ b/man/fusen-package.Rd @@ -19,11 +19,12 @@ Useful links: } \author{ -\strong{Maintainer}: Sebastien Rochette \email{sebastienrochettefr@gmail.com} (\href{https://orcid.org/0000-0002-1565-9313}{ORCID}) +\strong{Maintainer}: Vincent Guyader \email{vincent@thinkr.fr} (\href{https://orcid.org/0000-0003-0671-9270}{ORCID}) Authors: \itemize{ - \item Yohann Mansiaux \email{yohann.mansiaux@gmail.com.com} + \item Sebastien Rochette \email{sebastienrochettefr@gmail.com} (\href{https://orcid.org/0000-0002-1565-9313}{ORCID}) (creator) + \item Yohann Mansiaux \email{yohann.mansiaux@gmail.com} } Other contributors: diff --git a/man/sepuku.Rd b/man/sepuku.Rd index 1f9af304..e877fdda 100644 --- a/man/sepuku.Rd +++ b/man/sepuku.Rd @@ -17,7 +17,7 @@ sepuku(pkg = ".", force = FALSE, verbose = FALSE) side effect. A package cleaned from fusen-related files or tags } \description{ -This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to \code{fusen::inflate()} in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. +This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as Rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to \code{fusen::inflate()} in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. } \examples{ \dontrun{ diff --git a/man/sepuku_utils.Rd b/man/sepuku_utils.Rd index 234ddeff..a5ae0857 100644 --- a/man/sepuku_utils.Rd +++ b/man/sepuku_utils.Rd @@ -13,5 +13,5 @@ list_flat_files(pkg = ".") a vector of flat files paths } \description{ -Search for flat files listed in fusen config file, and for rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder +Search for flat files listed in fusen config file, and for Rmd and qmd files starting with "flat_" in dev/ folder, and dev/flat_history folder } diff --git a/tests/testthat/test-add_flat_template.R b/tests/testthat/test-add_flat_template.R index 9c333d7b..154f4c7b 100644 --- a/tests/testthat/test-add_flat_template.R +++ b/tests/testthat/test-add_flat_template.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_create_flat.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_create_flat.Rmd: do not edit by hand # nolint: line_length_linter. # Create a new project dummypackage <- tempfile(pattern = "add.flat.template") @@ -337,6 +337,7 @@ for (template in all_templates) { expect_true(sum(grepl(paste0("fusen::inflate\\(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\""), flat_lines)) == 1) withr::with_dir(dummypackage4, { + skip_on_os(os = "mac", arch = "x86_64") inflate_command <- paste0("fusen::inflate(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\", open_vignette = FALSE, check = FALSE)") expect_error(suppressMessages(eval(parse(text = inflate_command))), regexp = NA) }) @@ -345,6 +346,7 @@ for (template in all_templates) { # Now try to inflates a second time test_that("flat file inflates a second time", { withr::with_dir(dummypackage4, { + skip_on_os(os = "mac", arch = "x86_64") inflate_command_second <- paste0("fusen::inflate(flat_file = \"dev/flat_", main_flat_file_name, ".Rmd\", open_vignette = FALSE, check = FALSE, overwrite = TRUE)") expect_error(suppressMessages(eval(parse(text = inflate_command_second))), regexp = NA) }) diff --git a/tests/testthat/test-build_fusen_chunks.R b/tests/testthat/test-build_fusen_chunks.R index d029cb04..9e819d28 100644 --- a/tests/testthat/test-build_fusen_chunks.R +++ b/tests/testthat/test-build_fusen_chunks.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_addins.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_addins.Rmd: do not edit by hand # nolint: line_length_linter. # No tests for addins diff --git a/tests/testthat/test-deprecate_flat_file.R b/tests/testthat/test-deprecate_flat_file.R index 8369371d..d1aed15c 100644 --- a/tests/testthat/test-deprecate_flat_file.R +++ b/tests/testthat/test-deprecate_flat_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand # nolint: line_length_linter. dummypackage <- tempfile("deprecate") dir.create(dummypackage) diff --git a/tests/testthat/test-get_all_created_funs.R b/tests/testthat/test-get_all_created_funs.R index 6397a676..9273357f 100644 --- a/tests/testthat/test-get_all_created_funs.R +++ b/tests/testthat/test-get_all_created_funs.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand # nolint: line_length_linter. test_that("get_all_created_funs works", { expect_true(inherits(get_all_created_funs, "function")) diff --git a/tests/testthat/test-get_package_structure.R b/tests/testthat/test-get_package_structure.R index 5e436535..3e0c74ec 100644 --- a/tests/testthat/test-get_package_structure.R +++ b/tests/testthat/test-get_package_structure.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_get_package_structure.Rmd: do not edit by hand # nolint: line_length_linter. # Test full ---- dummypackage <- tempfile("drawpkg.structure") diff --git a/tests/testthat/test-inflate-part1.R b/tests/testthat/test-inflate-part1.R index 9f0f7456..c4b53bb4 100644 --- a/tests/testthat/test-inflate-part1.R +++ b/tests/testthat/test-inflate-part1.R @@ -80,14 +80,14 @@ usethis::with_project(dummypackage, { test_that("inflate - R files contents are ok", { # examples in R files my_median_lines <- readLines(my_median_file) - expect_equal(my_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand") + expect_equal(my_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.") expect_true(all(my_median_lines[12:14] == c( "#' @examples", "#' my_median(2:20)", "#' my_median(1:12)" ))) my_other_median_lines <- readLines(my_other_median_file) - expect_equal(my_other_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand") + expect_equal(my_other_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.") expect_true(all(my_other_median_lines[12:15] == c( "#' @examples", "#' my_other_median(1:12)", @@ -117,7 +117,7 @@ usethis::with_project(dummypackage, { # _no roxygen at all my_norox_lines <- readLines(my_noroxfunctionfile) expect_true(all(my_norox_lines == c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' @noRd", "my_norox <- function(x) {", @@ -130,7 +130,7 @@ usethis::with_project(dummypackage, { expect_equal( my_norox2_lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' @noRd", "#' @examples", @@ -192,7 +192,7 @@ usethis::with_project(dummypackage, { expect_equal( test_lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "test_that(\"my_median works properly and show error if needed\", {", " expect_error(my_median(\"text\"))", diff --git a/tests/testthat/test-inflate-part2.R b/tests/testthat/test-inflate-part2.R index b49bd8c2..9c66f097 100644 --- a/tests/testthat/test-inflate-part2.R +++ b/tests/testthat/test-inflate-part2.R @@ -1207,7 +1207,7 @@ usethis::with_project(dummypackage, { expect_equal( lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' my_twoexamples", "#' @param x x", diff --git a/tests/testthat/test-inflate_all.R b/tests/testthat/test-inflate_all.R index f4b40b75..c11011ee 100644 --- a/tests/testthat/test-inflate_all.R +++ b/tests/testthat/test-inflate_all.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all.Rmd: do not edit by hand # nolint: line_length_linter. # unlink(dummypackage, recursive = TRUE) dummypackage <- tempfile("inflateall.first") diff --git a/tests/testthat/test-inflate_all_utils.R b/tests/testthat/test-inflate_all_utils.R index d8602e5d..96a072db 100644 --- a/tests/testthat/test-inflate_all_utils.R +++ b/tests/testthat/test-inflate_all_utils.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand # nolint: line_length_linter. dummypackage <- tempfile("diag") dir.create(dummypackage) diff --git a/tests/testthat/test-init_share_on_github.R b/tests/testthat/test-init_share_on_github.R index 7281d720..e7538de7 100644 --- a/tests/testthat/test-init_share_on_github.R +++ b/tests/testthat/test-init_share_on_github.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_init_share_on_github.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_init_share_on_github.Rmd: do not edit by hand # nolint: line_length_linter. test_that("init_share_on_github works", { skip_if_not(interactive()) diff --git a/tests/testthat/test-pre_inflate_all_diagnosis_eval.R b/tests/testthat/test-pre_inflate_all_diagnosis_eval.R index e8829b31..4996aeb2 100644 --- a/tests/testthat/test-pre_inflate_all_diagnosis_eval.R +++ b/tests/testthat/test-pre_inflate_all_diagnosis_eval.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_inflate_all_utils.Rmd: do not edit by hand # nolint: line_length_linter. test_that("pre_inflate_all_diagnosis_eval works", { expect_true(inherits(pre_inflate_all_diagnosis_eval, "function")) diff --git a/tests/testthat/test-register_config_file.R b/tests/testthat/test-register_config_file.R index 34efa7dc..46e2de65 100644 --- a/tests/testthat/test-register_config_file.R +++ b/tests/testthat/test-register_config_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_register_config_file.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_register_config_file.Rmd: do not edit by hand # nolint: line_length_linter. dummypackage <- tempfile("registered") dir.create(dummypackage) diff --git a/tests/testthat/test-rename_flat_file.R b/tests/testthat/test-rename_flat_file.R index 7d449f6d..2c093b59 100644 --- a/tests/testthat/test-rename_flat_file.R +++ b/tests/testthat/test-rename_flat_file.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_deal_with_flat_files.Rmd: do not edit by hand # nolint: line_length_linter. dummypackage <- tempfile("rename") dir.create(dummypackage) diff --git a/tests/testthat/test-sepuku.R b/tests/testthat/test-sepuku.R index 20b781f0..4a05bc2f 100644 --- a/tests/testthat/test-sepuku.R +++ b/tests/testthat/test-sepuku.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_sepuku.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_sepuku.Rmd: do not edit by hand # nolint: line_length_linter. dummypackage <- tempfile(paste0(sample(letters, 10), collapse = "")) dir.create(dummypackage) @@ -25,7 +25,7 @@ usethis::with_project(dummypackage, { dir.create(file.path(dummypackage, "dev")) expect_message( sepuku(force = TRUE), - "No fusen configuration file found. The flat files to be deleted will be identified as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders." + "No fusen configuration file found. The flat files to be deleted will be identified as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders." ) }) @@ -50,7 +50,7 @@ usethis::with_project(dummypackage, { expect_message( sepuku(force = TRUE), - "A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted." + "A fusen configuration file was found. The flat files to be deleted will be identified as files listed in this configuration file as well as Rmd or qmd files starting with 'flat' in the dev/ and dev/flat_history folders. The configuration file will also be deleted." ) }) diff --git a/tests/testthat/test-sepuku_utils.R b/tests/testthat/test-sepuku_utils.R index 1921b511..1c2e6154 100644 --- a/tests/testthat/test-sepuku_utils.R +++ b/tests/testthat/test-sepuku_utils.R @@ -1,4 +1,4 @@ -# WARNING - Generated by {fusen} from dev/flat_sepuku-utils.Rmd: do not edit by hand +# WARNING - Generated by {fusen} from dev/flat_sepuku-utils.Rmd: do not edit by hand # nolint: line_length_linter. test_that("list_flat_files_in_config_file is a function", { expect_true(inherits(list_flat_files_in_config_file, "function")) @@ -90,7 +90,7 @@ usethis::with_project(dummypackage, { # Add licence usethis::use_mit_license("John Doe") - test_that("list_flat_files_in_dev_folder works for rmd and qmd files in dev folder starting with flat", { + test_that("list_flat_files_in_dev_folder works for Rmd and qmd files in dev folder starting with flat", { flat_file_with_bad_name <- "xxx_flat2.Rmd" file.create(file.path(dummypackage, "dev", flat_file_with_bad_name)) @@ -116,7 +116,7 @@ usethis::with_project(dummypackage, { ) }) - test_that("list_flat_files_in_dev_folder works for rmd and qmd files in flat_history folder starting with flat", { + test_that("list_flat_files_in_dev_folder works for Rmd and qmd files in flat_history folder starting with flat", { inflate( pkg = dummypackage, flat_file = flat_file1, diff --git a/vignettes/deal-with-a-fusen-flat-file.Rmd b/vignettes/deal-with-a-fusen-flat-file.Rmd index 6ed59dd4..f6124848 100644 --- a/vignettes/deal-with-a-fusen-flat-file.Rmd +++ b/vignettes/deal-with-a-fusen-flat-file.Rmd @@ -52,7 +52,7 @@ rename_flat_file( ## Fully deprecate a flat file after inflate -'fusen' serves as a framework to ensure that developers prioritize end-users during the function development process. By employing 'fusen' within Rmd/Qmd files, developers can conceptualize their product and articulate their ideas in plain text before initiating any code. This approach encourages consideration of the package's users: their intended actions, and the potential impact on their experiences. Consequently, developers can draft function documentation prior to its implementation, thinking about explaining what's behind the black box, as well as reminding that this may end into the vignette. +'fusen' serves as a framework to ensure that developers prioritize end-users during the function development process. By employing 'fusen' within Rmd/qmd files, developers can conceptualize their product and articulate their ideas in plain text before initiating any code. This approach encourages consideration of the package's users: their intended actions, and the potential impact on their experiences. Consequently, developers can draft function documentation prior to its implementation, thinking about explaining what's behind the black box, as well as reminding that this may end into the vignette. Additionally, 'fusen' offers a minimal template comprising 'function', 'doc', and 'test' components. We advocate for Test Driven Development (TDD), where writing tests precedes function implementation. This practice aids in function design and enables anticipation of future behavior. diff --git a/vignettes/switch-from-a-package-developed-with-fusen-to-a-classical-package.Rmd b/vignettes/switch-from-a-package-developed-with-fusen-to-a-classical-package.Rmd index b5e093bf..3dff22f3 100644 --- a/vignettes/switch-from-a-package-developed-with-fusen-to-a-classical-package.Rmd +++ b/vignettes/switch-from-a-package-developed-with-fusen-to-a-classical-package.Rmd @@ -25,7 +25,7 @@ library(fusen) # Move from a package developed with fusen to a "classical" package -After a while, you may want to move from a package developed with fusen to a "classical" package. This is possible with the `sepuku()` function. This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. +After a while, you may want to move from a package developed with fusen to a "classical" package. This is possible with the `sepuku()` function. This function will delete all the flat files (i.e files listed in the fusen configuration file, as well as Rmd or qmd files starting with "flat" in the "dev/" and "dev/flat_history" folders). It will also remove the fusen-related tags added by calls to `fusen::inflate()` in files located in the "R/", "tests/" and "vignettes/" folders. Finally, it will also remove the fusen configuration file if it exists. Switching from a package developed with fusen to a "classical" package might be useful if you want to share your package with someone who is not familiar with fusen or if you want to stop using fusen for any reason. diff --git a/vignettes/tips-and-tricks.Rmd b/vignettes/tips-and-tricks.Rmd index 081eb270..73df892b 100644 --- a/vignettes/tips-and-tricks.Rmd +++ b/vignettes/tips-and-tricks.Rmd @@ -149,7 +149,7 @@ If this is the second function inside an existing template: ## How to pre-fill multiple functions in one template -This can be added in the "dev_history.Rmd", and will replace a place holder in your flat rmd (`HERE` in this case) with proper fusen chunks for all your future functions to be. +This can be added in the "dev_history.Rmd", and will replace a place holder in your flat Rmd (`HERE` in this case) with proper fusen chunks for all your future functions to be. - Add a line with `HERE` in your flat file ```r @@ -425,3 +425,7 @@ Although default {golem} "dev/" files already contain the main actions to mainta 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. + +# How can I get rid of everything related to 'fusen' in my package ? + +You can use `sepuku()` to remove all the flat files, the fusen tags in the R files and the fusen configuration file. Hence, you will get a project that looks like any other R package. \ No newline at end of file