Skip to content
Snippets Groups Projects

Resolve "Migrate `getDataPath` function and environment"

Merged David Dorchies requested to merge 2-migrate-getdatapath-function-and-environment into main
Files
3
+ 12
8
#' Create a "fairified" project
#' Create a "fairify" project
#'
#' Create a package ready for fairify your project.
#'
#' @inheritParams usethis::create_package
#' @param tidy if `TRUE`, run [usethis::use_testthat()], [usethis::use_tidy_description()], and [usethis::use_tidy_dependencies()]
#' @param with_reports If `TRUE`, run `create_reports`, preparing package structure for report publications
#' @param tidy if `TRUE`, run [usethis::use_testthat()], and [usethis::use_tidy_description()]
#' @param reports If `TRUE`, run `create_reports`, preparing package structure for report publications
#' @param cloud If `TRUE`, copy fairify functions for cloud capabilities
#' @param git if `TRUE`, initialises a Git repository
#' @param ... Further parameters passed to [usethis::create_package]
#'
@@ -13,18 +14,20 @@
#'
#' @examples
#' path <- tempfile(pattern = "dir")
#' create_fairify(path, open = FALSE)
#' create_fairify(path, open = FALSE, git = FALSE)
#' list.files(path)
create_fairify <-
function(path,
tidy = TRUE,
check_name = FALSE,
open = rlang::is_interactive(),
with_reports = TRUE,
reports = TRUE,
cloud = TRUE,
git = TRUE,
...) {
usethis::create_package(path, rstudio = TRUE, open = FALSE, check_name = check_name, ...)
usethis::proj_set(path)
if (cloud) update_fairify(path)
if (tidy) {
usethis::local_project(path)
usethis::use_testthat()
@@ -34,10 +37,11 @@ create_fairify <-
gert::git_init(path)
add_gitignore(path)
}
if (with_reports)
create_reports(path = path)
if (reports)
create_reports(path = path, git = git)
usethis::use_package("fairify", "Depends")
#file.copy()
message("Fairify project created")
message("Don't forget to edit the file `inst/config.yml` for configuring the data location for your project")
if (open) {
usethis::proj_activate(path)
}
Loading