SCM

SCM Repository

[inlinedocs] Diff of /pkg/inlinedocs/R/test.R
ViewVC logotype

Diff of /pkg/inlinedocs/R/test.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 247, Thu Apr 7 13:22:13 2011 UTC revision 307, Fri Oct 21 11:37:19 2011 UTC
# Line 26  Line 26 
26        .res <- .fun[[N]]        .res <- .fun[[N]]
27        res <- fun[[N]]        res <- fun[[N]]
28        if(is.null(res) || is.na(res) || is.na(.res) || .res!=res){        if(is.null(res) || is.na(res) || is.na(.res) || .res!=res){
29          stop(f,":\n\n",res,"\nin ",FUN,"$",N,", expected:\n\n",.res,"\n")          cat("\n-----\n",res,"\n-----\nin ",FUN,
30                "$",N,", expected:\n-----\n",.res,"\n-----\n")
31            stop("docs mismatch in ",f)
32        }        }
33      }      }
34      ## now check and see if there are no additional items!      ## now check and see if there are no additional items!
# Line 46  Line 48 
48      stop("extracted some unexpected documentation objects!")      stop("extracted some unexpected documentation objects!")
49    }    }
50    ## finally make a package using this file and see if it passes    ## finally make a package using this file and see if it passes
51    ## without warnings    ## without warnings TDH 27 May 2011 added !interactive() since
52    if(!is.null(e$.dontcheck))return()    ## recursive calling R CMD check seems to systematically
53      ## fail... ERROR: startup.Rs not found. This file is usually copied
54      ## to the check directory and read as a .Rprofile, as done in
55      ## tools:::.runPackageTests ... is this a bug in R? Anyway for now
56      ## let's just not run the R CMD check.
57      if(!is.null(e$.dontcheck) || !interactive())return()
58    make.package.and.check(f,parsers,verbose)    make.package.and.check(f,parsers,verbose)
59    if(verbose)cat("\n")    if(verbose)cat("\n")
60  }  }
61    
62  ### Make a package by processing f with a standard DESCRIPTION, and  make.package.and.check <- function
63  ### stop if there are errors or warnings.  ### Assemble some R code into a package and process it using R CMD
64  make.package.and.check <- function(f,parsers=default.parsers,verbose=TRUE){  ### check, stopping with an error if the check resulted in any errors
65    pkgname <- sub(".[rR]$","",basename(f))  ### or warnings.
66    (f, ##<< R code file name from which we will make a package
67     parsers=default.parsers,
68    ### Parsers to use to make the package documentation.
69     verbose=TRUE
70    ### print the check command line?
71     ){
72      pkgname <- sub("[.][rR]$","",basename(f))
73    pkgdir <- file.path(tempdir(),pkgname)    pkgdir <- file.path(tempdir(),pkgname)
74    if(file.exists(pkgdir))unlink(pkgdir,recursive=TRUE)    if(file.exists(pkgdir))unlink(pkgdir,recursive=TRUE)
75    rdir <- file.path(pkgdir,"R")    rdir <- file.path(pkgdir,"R")
76      if(verbose)print(rdir)
77    dir.create(rdir,recursive=TRUE)    dir.create(rdir,recursive=TRUE)
78    desc <- file.path(system.file(package="inlinedocs"),"silly","DESCRIPTION")    desc <- system.file(file.path("silly","DESCRIPTION"),package="inlinedocs")
79    file.copy(desc,pkgdir)    file.copy(desc,pkgdir)
80    file.copy(f,rdir)    file.copy(f,rdir)
   print(pkgdir)  
81    package.skeleton.dx(pkgdir,parsers)    package.skeleton.dx(pkgdir,parsers)
82    cmd <- sprintf("%s CMD check %s",file.path(R.home("bin"), "R"),pkgdir)    cmd <- sprintf("%s CMD check %s",file.path(R.home("bin"), "R"),pkgdir)
83    if(verbose)cat(cmd,"\n")    if(verbose)cat(cmd,"\n")
84    checkLines <- system(cmd,intern=TRUE)    checkLines <- system(cmd,intern=TRUE)
85    warnLines <- grep("WARNING",checkLines,value=TRUE)    warnLines <- grep("(WARNING|ERROR)",checkLines,value=TRUE)
86    if(length(warnLines)>0){    if(length(warnLines)>0){
87      print(warnLines)      print(warnLines)
88      stop("WARNING encountered in package check!")      stop("ERROR/WARNING encountered in package check!")
89    }    }
90  }  }
91    

Legend:
Removed from v.247  
changed lines
  Added in v.307

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge