-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_package.R
executable file
·52 lines (41 loc) · 1.31 KB
/
check_package.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
#!/usr/bin/env Rscript
options(crayon.enabled = TRUE)
# Set environment variables
Sys.setenv(LOGNAME = Sys.info()[["user"]])
Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false")
Sys.setenv("_R_CHECK_CRAN_INCOMING_" = "false")
# Define the check directory
check_dir_path <- file.path(getwd(), "check")
# Print equivalent output
cat("LOGNAME=", Sys.getenv("LOGNAME"), "\n")
cat("check-dir-path=", check_dir_path, "\n")
# Ensure required packages are installed
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
if (!requireNamespace("rcmdcheck", quietly = TRUE)) {
install.packages("rcmdcheck")
}
# Delete NAMESPACE and man/ to force Roxygen to regenerate them
namespace_file <- "NAMESPACE"
man_dir <- "man"
if (file.exists(namespace_file)) {
file.remove(namespace_file)
cat("Deleted existing NAMESPACE file.\n")
}
if (dir.exists(man_dir)) {
unlink(man_dir, recursive = TRUE)
cat("Deleted existing man/ directory.\n")
}
# Rebuild documentation
cat("Running devtools::document()...\n")
devtools::document()
# Run package check
cat("Running rcmdcheck::rcmdcheck()...\n")
rcmdcheck::rcmdcheck(
args = c("--no-manual", "--as-cran"),
build_args = c("--no-manual", "--compact-vignettes=gs+qpdf"),
error_on = "warning",
check_dir = check_dir_path
)
BiocCheck::BiocCheck('new-package'=TRUE)