Skip to content

Commit

Permalink
Check for file existence and check early (#2363)
Browse files Browse the repository at this point in the history
* Check for file existence and check early

* Bump minimum version of cli; use cli_abort()
  • Loading branch information
jennybc authored Jul 20, 2021
1 parent 6d6ade5 commit 88afadc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Depends:
usethis (>= 2.0.1)
Imports:
callr (>= 3.6.0),
cli (>= 2.4.0),
cli (>= 3.0.0),
desc (>= 1.3.0),
ellipsis (>= 0.3.1),
fs (>= 1.5.0),
Expand Down
14 changes: 9 additions & 5 deletions R/build-readme.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ build_rmd <- function(files, path = ".", output_options = list(), ..., quiet = T
rlang::check_installed("rmarkdown")
save_all()

paths <- files
abs_files <- is_absolute_path(files)
paths[!abs_files] <- path(pkg$path, files[!abs_files])

ok <- file_exists(paths)
if (any(!ok)) {
cli::cli_abort("Can't find file{?s}: {.path {files[!ok]}}.")
}

cli::cli_alert_info("Installing {.pkg {pkg$package}} in temporary library")
withr::local_temp_libpaths()
install(pkg, upgrade = "never", reload = FALSE, quick = TRUE, quiet = quiet)

# Ensure rendering github_document() doesn't generate HTML file
output_options$html_preview <- FALSE

paths <- files

abs_files <- is_absolute_path(files)

paths[!abs_files] <- path(pkg$path, files[!abs_files])

for (path in paths) {
cli::cli_alert_info("Building {.path {path}}")
Expand Down

0 comments on commit 88afadc

Please sign in to comment.