R/updateSciptFiles.R

Defines functions updateAndInstall updateScriptFiles

Documented in updateAndInstall updateScriptFiles

#' 更新文档
#'
#' @return 返回值
#' @export
#'
#' @examples updateScriptFiles();
updateScriptFiles <- function(){
  #删除演示数据
  if(file.exists('R/hello.R')){
    file.remove('R/hello.R')
  }
  #同步删除hello生成的帮助手册md
  if(file.exists('man/hello.Rd')){
    file.remove('man/hello.Rd')
  }
  #删除namespace重新生成
  if(file.exists('NAMESPACE')){
    file.remove('NAMESPACE')
  }
  #更新文件
  devtools::document()
}


#' 更新文档
#'
#' @return 返回值
#' @export
#'
#' @examples updateScriptFiles();
updateAndInstall <- function(){
  #删除演示数据
  if(file.exists('R/hello.R')){
    file.remove('R/hello.R')
  }
  #同步删除hello生成的帮助手册md
  if(file.exists('man/hello.Rd')){
    file.remove('man/hello.Rd')
  }
  #删除namespace重新生成
  if(file.exists('NAMESPACE')){
    file.remove('NAMESPACE')
  }
  #更新文件
  devtools::document()
  #安装文件
  devtools::install()
  #重启一下R Session
  rstudioapi::restartSession()
}
takewiki/tstk documentation built on Oct. 1, 2023, 10:39 p.m.