R/clean_posts.R

Defines functions clean_posts_mlr3gallery

Documented in clean_posts_mlr3gallery

#' @title Clean Post Directory 
#'
#' @description
#' Remove html and ancillary files from `_post` directory.
#'
#' @export
clean_posts_mlr3gallery = function() {
  root = rprojroot::find_package_root_file()
  path = file.path(root, "_posts")
  htmls = list.files(path, pattern = "\\.html$", full.names = TRUE, recursive = TRUE)
  unlink(htmls)
  ancillary_files = list.files("_posts/", pattern = "^.*_files", include.dirs = TRUE, recursive = TRUE, full.names = TRUE)
  unlink(ancillary_files, recursive = TRUE)

  invisible(TRUE)
}
mlr-org/mlr3gallery documentation built on Nov. 17, 2022, 11:25 p.m.