-
Notifications
You must be signed in to change notification settings - Fork 2
/
package_check_build.R
49 lines (32 loc) · 1.31 KB
/
package_check_build.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
require(devtools)
require(tools)
options(encoding = "")
package_name <- "surveyplanning"
description <- readLines(paste0(package_name, "/DESCRIPTION"))
ver <- gsub(" |:|[A-z]", "", grep("Version", description, value = T))
ver
# Documentation
devtools::document(package_name, roclets = c("rd", "collate", "namespace"))
# Build source package
devtools::build(package_name)
# Check (devtools)
devtools::check(package_name)
# Check (R CMD)
system(paste0("R CMD check ", package_name, "_", ver, ".tar.gz"))
# Build binary package
devtools::build(package_name, binary = TRUE, args = c('--preclean'))
# Copy manual
file.copy(from = paste0(package_name, ".Rcheck/", package_name, "-manual.pdf"),
to = paste0(package_name, "_", ver, "-manual.pdf"), overwrite = TRUE)
# MD5
md5sums <- md5sum(list.files(pattern = "zip$|tar.gz$|pdf$"))
df <- data.frame(md5 = md5sums, filename = names(md5sums))
write.table(df, file = paste0(package_name, "_", ver, "_checksums.md5"),
sep = " ", row.names = F, col.names = F, quote = F)
# Install and load
detach(paste0("package:", package_name), unload = TRUE)
# Installē bināro versiju
install.packages(paste0(package_name, "_", ver, ".zip"), repos = NULL)
# Installē no pirmkoda
install.packages(paste0(package_name, "_", ver, ".tar.gz"), repos = NULL)
require(surveyplanning)