-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepForCRAN.R
50 lines (43 loc) · 2.18 KB
/
prepForCRAN.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
#----------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------
# Any bits of R code needed at the top level
#----------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------
# to submit to the CRAN:
# https://kalimu.github.io/post/checklist-for-r-package-submission-to-cran/
#----------------------------------------------------------------------------------------------
options(download.file.method = "libcurl")
# 1. check downstream dependencies from code in directory 'dependency checks'
# 2. ensure tarball is < 5MB
# 3. spell checks
devtools::spell_check()
# 4. win builder checks
devtools::check_win_release()
devtools::check_win_devel()
# 5. multi-platform rhub checks.
# default for check-rhub is R CMD --no-manual, which throws a note. Therefore change check_args to ""
# default for check-rhub is to run the slow examples (donttest). Therefore change enrionmental variables to '_R_CHECK_DONTTEST_EXAMPLES_' = "false"
devtools::check_rhub(platforms = NULL, check_args = "", env_vars = c('_R_CHECK_DONTTEST_EXAMPLES_' = "false"))
# 6. check any problems here:
https://cran.ma.imperial.ac.uk/web/checks/check_results_ADMUR.html
# 7. final submission:
devtools::release()
#----------------------------------------------------------------------------------------------
# search for any specific words or phrases in: .R, .md, .Rmd
#----------------------------------------------------------------------------------------------
#pattern <- '\\mjseqn'
#pattern <- '\\mjsdeqn'
#pattern <- 'Philo'
pattern <- 'svg'
#pattern <- 'power law'
man <- list.files('man',full.names=T, pattern='.Rd')
r <- list.files('R',full.names=T, pattern='.R')
vig <- list.files('vignettes',full.names=T, pattern='.Rmd')
files <- c(man,r,vig)
for(n in 1:length(files)){
x <- readLines(files[n])
i <- grepl(pattern,x, fixed = T)
bad <- x[i]
if(length(bad)>0)print(paste(files[n], bad))
}
#----------------------------------------------------------------------------------------------