owd <- setwd("~")
testPackagePath <- file.path( system.file(package="minimalErrorPkg"),"silly" )
file.copy(testPackagePath,".",recursive=TRUE)
## check the package to see if it passes without WARNINGs
cmd <- sprintf("%s CMD check --as-cran silly",file.path(R.home("bin"), "R"))
print(cmd)
checkLines <- system(cmd,intern=TRUE)
warnLines <- grep("WARNING",checkLines,value=TRUE)
if(length(warnLines)>0){
writeLines(checkLines)
cat("Lines with WARNING:
")
print(warnLines)
stop("WARNING encountered in package check!")
}
setwd(owd)
Run the code above in your browser using DataLab