@@ -46,14 +46,20 @@ buildLibrary<-function(lib=".",cran=TRUE, update_type=NULL){
4646 return (s );
4747 }
4848
49- didYouPull <- function () {
50- cat(" Is your repository up-to-date? Did you pull immediately before running this check? (yes/no)" )
49+ askYesNo <- function (question ) {
50+ cat(paste( question , " (yes/no)" ))
5151 s <- get_line()
52- if (! (tolower(s ) %in% c(" y" ," yes" ))) stop(" Please update your repository first, before you proceed!" )
52+ if (! (tolower(s ) %in% c(" y" ," yes" ))) return (FALSE )
53+ return (TRUE )
54+ }
55+
56+ didYouPull <- function () {
57+ if (! askYesNo(" Is your repository up-to-date? Did you pull immediately before running this check?" )){
58+ stop(" Please update your repository first, before you proceed!" )
59+ }
5360 }
5461 didYouPull()
5562
56- OS <- Sys.info()[" sysname" ]
5763 thisdir <- getwd()
5864 if (lib != " ." ) setwd(lib )
5965 on.exit(setwd(thisdir ))
@@ -78,7 +84,6 @@ buildLibrary<-function(lib=".",cran=TRUE, update_type=NULL){
7884 # ###########################################################
7985 # check the library
8086 # ###########################################################
81- ck <- devtools :: check(" ." ,cran = cran )
8287
8388 if (! file.exists(" .buildlibrary" )) {
8489 # if not yet available, add .buildlibrary and add to .Rbuildignore
@@ -99,11 +104,30 @@ buildLibrary<-function(lib=".",cran=TRUE, update_type=NULL){
99104 }
100105
101106 cfg <- read_yaml(" .buildlibrary" )
107+
102108 if (is.null(cfg $ AutocreateReadme )) cfg $ AutocreateReadme <- TRUE
109+ if (is.null(cfg $ UseGithubActions ) &&
110+ askYesNo(" Do you want to use GitHub Actions for package testing?" )) cfg $ UseGithubActions <- TRUE
111+
112+ if (isTRUE(cfg $ UseGithubActions )) {
113+ addGitHubActions(lib )
114+ # remove travis related parts
115+ travisfile <- paste0(lib ," /.travis.yml" )
116+ if (file.exists(travisfile )) {
117+ file.remove(travisfile )
118+ rbuildignore <- paste0(lib ," /.Rbuildignore" )
119+ if (file.exists(rbuildignore )) {
120+ a <- readLines(rbuildignore )
121+ writeLines(grep(" travis" ,a ,value = TRUE ,invert = TRUE ), rbuildignore )
122+ }
123+ travistest <- paste0(lib ," /tests/testthat/test-travisCI.R" )
124+ if (file.exists(travistest )) file.remove(travistest )
125+ }
126+ }
127+
128+ ck <- devtools :: check(" ." ,cran = cran )
103129
104130 # Filter warnings and notes which are accepted
105- accepted_warnings <- c(" Warning: package '.*' was built under R version" ,
106- " Warning: namespace '.*' is not available and has been replaced" )
107131 for (aw in cfg $ AcceptedWarnings ) {
108132 ck $ warnings <- grep(aw , ck $ warnings , value = TRUE ,invert = TRUE )
109133 }
0 commit comments