Inflate all the flat files stored in "dev/" and starting with "flat_"
inflate_all(
pkg = ".",
document = TRUE,
check = TRUE,
open_vignette = FALSE,
overwrite = TRUE,
clean = TRUE,
stylers,
...
)
inflate_all_no_check(
pkg = ".",
document = TRUE,
open_vignette = FALSE,
overwrite = TRUE,
clean = TRUE,
stylers,
...
)
Path to package
Logical. Whether to document your package using att_amend_desc
Logical. Whether to check package after Rmd inflating
Logical. Whether to open vignette file at the end of the process
Logical (TRUE, FALSE) or character ("ask", "yes", "no). Whether to overwrite vignette and functions if already exists.
Logical. Whether to help detect unregistered files.
Function to be run at the end of the process, like styler::style_pkg
or lintr::lint_package
or a lambda function combining functions like: function() {styler::style_pkg(); lintr::lint_package()}
. For a unique function, use the format without parenthesis ()
at the end of the command.
Arguments passed to devtools::check()
.
For example, you can do inflate(check = TRUE, quiet = TRUE)
, where quiet
is
passed to devtools::check()
.
side effect. Inflates all your flat files that can be inflated.
This requires to inflate()
all flat files individually at least once, so that their specific inflate configurations are stored.
This also requires to register all R, tests and vignettes files of your package, even if not created with an inflate. Run inflate_all()
once and read the messages. The first time, you will probably need to run register_all_to_config()
if your package is not new.
For more information, read the vignette("inflate-all-your-flat-files", package = "fusen")
inflate()
for the options of a single file inflate,
check_not_registered_files()
for the list of files not already associated with a flat file in the config file,
register_all_to_config()
for automatically registering all files already present in the project before the first inflate_all()
if (FALSE) {
# Usually, in the current package run inflate_all() directly
# These functions change the current user workspace
inflate_all()
# Or inflate_all_no_check() to prevent checks to run
inflate_all_no_check()
# Or inflate with the styler you want
inflate_all(stylers = styler::style_pkg)
}
# You can also inflate_all flats of another package as follows
# Example with a dummy package with a flat file
dummypackage <- tempfile("inflateall.otherpkg")
dir.create(dummypackage)
fill_description(pkg = dummypackage, fields = list(Title = "Dummy Package"))
#> [1] "/tmp/RtmppuBulN/inflateall.otherpkg19de4e0792ee/DESCRIPTION"
flat_files <- add_minimal_package(
pkg = dummypackage,
overwrite = TRUE,
open = FALSE
)
#> Created file .here in /tmp/RtmppuBulN/inflateall.otherpkg19de4e0792ee . Please start a new R session in the new project directory.
flat_file <- flat_files[grep("flat", basename(flat_files))]
# Inflate the flat file once
usethis::with_project(dummypackage, {
# if you are starting from a brand new package, inflate_all() will crash
# it's because of the absence of a fusen config file
#
# inflate_all() # will crash
# Add licence
usethis::use_mit_license("John Doe")
# you need to inflate manually your flat file first
inflate(
pkg = dummypackage,
flat_file = flat_file,
vignette_name = "Get started",
check = FALSE,
open_vignette = FALSE,
document = TRUE,
overwrite = "yes"
)
# your config file has been created
config_yml_ref <-
yaml::read_yaml(getOption("fusen.config_file", default = "dev/config_fusen.yaml"))
})
#> ✔ Setting active project to '/tmp/RtmppuBulN/inflateall.otherpkg19de4e0792ee'
#> ✔ Adding 'MIT + file LICENSE' to License
#> ✔ Writing 'LICENSE'
#> ✔ Writing 'LICENSE.md'
#> ✔ Adding '^LICENSE\\.md$' to '.Rbuildignore'
#> ℹ Loading inflateall.otherpkg19de4e0792ee
#> Writing NAMESPACE
#> ✔ Adding 'knitr' to Suggests field in DESCRIPTION
#> • Use `requireNamespace("knitr", quietly = TRUE)` to test if package is installed
#> • Then directly refer to functions with `knitr::fun()`
#> ✔ Adding 'inst/doc' to '.gitignore'
#> ── config file for dev/flat_minimal.Rmd ────────────────────────────────────────
#> ✔ path: dev/flat_minimal.Rmd was added to the config file
#> ✔ state: active was added to the config file
#> ✔ R: R/my_fun.R was added to the config file
#> ✔ tests: tests/testthat/test-my_fun.R was added to the config file
#> ✔ vignettes: vignettes/get-started.Rmd was added to the config file
#> ✔ inflate: each parameter was added to the config file
#> Saving attachment parameters to yaml config file
#> Updating inflateall.otherpkg19de4e0792ee documentation
#> ℹ Loading inflateall.otherpkg19de4e0792ee
#> Writing NAMESPACE
#> Writing my_fun.Rd
#> ℹ Loading inflateall.otherpkg19de4e0792ee
#> [+] 2 package(s) added: rmarkdown, testthat.
#> ✔ Setting active project to '/tmp/RtmppuBulN/dummy.package19de7c16a656'
# Next time, you can run inflate_all() directly
usethis::with_project(dummypackage, {
# now you can run inflate_all()
inflate_all(check = FALSE, document = TRUE)
})
#> ✔ Setting active project to '/tmp/RtmppuBulN/inflateall.otherpkg19de4e0792ee'
#> ✔ The flat file flat_minimal.Rmd is going to be inflated
#> ── config file for dev/flat_minimal.Rmd ────────────────────────────────────────
#> ── check not registered files ──────────────────────────────────────────────────
#> ✔ There are no unregistered files.
#> Documentation parameters were restored from attachment config file.
#> Updating inflateall.otherpkg19de4e0792ee documentation
#> ℹ Loading inflateall.otherpkg19de4e0792ee
#> Writing NAMESPACE
#> ℹ Loading inflateall.otherpkg19de4e0792ee
#> ✔ Setting active project to '/tmp/RtmppuBulN/dummy.package19de7c16a656'
# Clean the temporary directory
unlink(dummypackage, recursive = TRUE)