-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
_updateModules.R
128 lines (96 loc) · 3.48 KB
/
_updateModules.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
update_description_files <- function(paths, version, date) {
version_pattern <- "Version:.*$"
date_pattern <- "Date:.*$"
version_replacement <- paste0("Version: ", version)
date_replacement <- paste0("Date: ", date)
xfun::gsub_files(files = paths, pattern = version_pattern, replacement = version_replacement)
xfun::gsub_files(files = paths, pattern = date_pattern, replacement = date_replacement)
}
update_yaml_files <- function(paths, version, date) {
version_pattern <- "version:.*$"
date_pattern <- "date:.*$"
version_replacement <- paste0("version: ", version)
date_replacement <- paste0("date: '", date, "'")
xfun::gsub_files(files = paths, pattern = version_pattern, replacement = version_replacement)
xfun::gsub_files(files = paths, pattern = date_pattern, replacement = date_replacement)
}
copy_module_files <- function(module_names, source_dir, dest_dir, file_extensions) {
for (module_name in module_names) {
for (ext in file_extensions) {
source_path <- paste0(source_dir, module_name, ext)
dest_path <- paste0(dest_dir, module_name, ext)
fs::file_copy(path = source_path, new_path = dest_path, overwrite = TRUE)
}
}
}
new_version <- "0.0.2.26"
new_date <- "2024-01-19"
description_paths <-
c("./DESCRIPTION",
"./jjstatsplot/DESCRIPTION",
"./meddecide/DESCRIPTION",
"./jsurvival/DESCRIPTION",
"./ClinicoPathDescriptives/DESCRIPTION")
update_description_files(paths = description_paths,
version = new_version,
date = new_date
)
yaml_paths <-
c("./jamovi/0000.yaml",
"./jjstatsplot/jamovi/0000.yaml",
"./meddecide/jamovi/0000.yaml",
"./jsurvival/jamovi/0000.yaml",
"./ClinicoPathDescriptives/jamovi/0000.yaml")
update_yaml_files(paths = yaml_paths,
version = new_version,
date = new_date
)
jjstatsplot_modules <- c(
"jjbarstats",
"jjbetweenstats",
"jjwithinstats",
"jjcorrmat",
"jjdotplotstats",
"jjhistostats",
"jjpiestats",
"jjscatterstats"
)
copy_module_files(jjstatsplot_modules, "./R/", "./jjstatsplot/R/", c(".b.R"))
copy_module_files(jjstatsplot_modules, "./jamovi/", "./jjstatsplot/jamovi/", c(".a.yaml", ".r.yaml", ".u.yaml"))
meddecide_modules <- c(
"agreement",
"decision",
"decisioncalculator",
"kappasizeci",
"kappasizefixedn",
"kappasizepower"
)
copy_module_files(meddecide_modules, "./R/", "./meddecide/R/", c(".b.R"))
copy_module_files(meddecide_modules, "./jamovi/", "./meddecide/jamovi/", c(".a.yaml", ".r.yaml", ".u.yaml"))
jsurvival_modules <- c(
"multisurvival",
"oddsratio",
"singlearm",
"survival",
"survivalcont"
)
copy_module_files(jsurvival_modules, "./R/", "./jsurvival/R/", c(".b.R"))
copy_module_files(jsurvival_modules, "./jamovi/", "./jsurvival/jamovi/", c(".a.yaml", ".r.yaml", ".u.yaml"))
ClinicoPathDescriptives_modules <- c(
"agepyramid",
"alluvial",
"benford",
"crosstable",
"reportcat",
"summarydata",
"tableone",
"vartree",
"venn"
)
copy_module_files(ClinicoPathDescriptives_modules, "./R/", "./ClinicoPathDescriptives/R/", c(".b.R"))
copy_module_files(ClinicoPathDescriptives_modules, "./jamovi/", "./ClinicoPathDescriptives/jamovi/", c(".a.yaml", ".r.yaml", ".u.yaml"))
jmvtools::prepare(".")
devtools::document(".")
jmvtools::prepare(".")
devtools::document(".")
jmvtools::install(".")