forked from UBESP-DCTV/laims.analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-FIRST_RUN.R
107 lines (86 loc) · 3.16 KB
/
01-FIRST_RUN.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# FIRST RUN ONLY ---------------------------------------------------
## - [ ] Change the name of `zeta.analyses.Rproj` using your main
## project's directory name accordingly. To do that,
## simply run the following code
prj_name <- basename(here::here())
fs::file_move(
here::here("zeta.analysis.Rproj"), # old project's name
paste0(prj_name, ".Rproj") # current project's name
)
here::here() |>
list.files(
pattern = "\\.([rR]|([rR]?md))$",
recursive = TRUE,
all.files = TRUE
) |>
setdiff(c("01-FIRST_RUN.R", ".Rprofile")) |>
c("DESCRIPTION") |>
purrr::walk(~{
readLines(.x) |>
stringr::str_replace_all("zeta\\.analysis", prj_name) |>
writeLines(.x)
})
## - [ ] Fill the DESCRIPTION file
## > do change `Package:` definition in the first line with your
## current project's name (i.e. your main folder's name)
usethis::edit_file("DESCRIPTION")
# After that you can produce the basic project's documentation running
# the following code
usethis::use_package_doc(open = FALSE)
## - [ ] Fill the projects' environmental variables inside the
## project's `.Renviron` which can be opened running the
## following code.
usethis::edit_r_environ("project")
## [Optional] Finaly, update all your packages in the project's library.
renv::upgrade()
renv::update()
renv::status()
renv::snapshot()
## At your convenience, replace your readme file
usethis::use_readme_rmd()
usethis::use_lifecycle_badge("experimental")
usethis::use_github_actions_badge("check-release")
usethis::use_github_actions_badge("test-coverage")
usethis::use_github_actions_badge("lint")
# put your email here, i.e. usethis::use_code_of_conduct("[email protected]")
usethis::use_code_of_conduct("[email protected]")
devtools::build_readme()
## So you can put this very file in the `dev/` folder, where you can
## find another useful file 02-dev_cycle.R
{
fs::file_move("01-FIRST_RUN.R", "dev/01-first_run.R")
rstudioapi::documentClose()
usethis::ui_done(paste0(
"{usethis::ui_value('01-FIRST_RUN.R')} moved to",
"{usethis::ui_value('dev/01-first_run.R')}, and closed."
))
rstudioapi::navigateToFile(here::here("dev/02-dev_cycle.R"))
usethis::ui_todo(paste0(
"Use {usethis::ui_value('02-dev_cycle.R')} ",
"to maintain the project updated during its development."
))
rstudioapi::navigateToFile(here::here("dev/03-run_cycle.R"))
rstudioapi::navigateToFile(here::here("_targets.R"))
usethis::ui_todo(
"Use {usethis::ui_value('_targets.R')} to define your pipelines."
)
rstudioapi::navigateToFile(
here::here("tests/testthat/test-functions.R")
)
rstudioapi::navigateToFile(here::here("R/functions.R"))
usethis::ui_todo(
"Use {usethis::ui_value('functions.R')} for your main functions."
)
rstudioapi::navigateToFile(
here::here("tests/testthat/test-utils.R")
)
rstudioapi::navigateToFile(here::here("R/utils.R"))
usethis::ui_todo(
"Use {usethis::ui_value('utils.R')} for your wrappers."
)
rstudioapi::navigateToFile(here::here("dev/03-run_cycle.R"))
usethis::ui_todo(paste0(
"Use {usethis::ui_value('03-run_cycle.R')} ",
"to check and execute the pipeline at each iteration."
))
}