-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bypassing dependency overwrite #113
base: main
Are you sure you want to change the base?
Conversation
…n which allows the user to specify whether or not html dependencies should be overwritten. When used to, for example, render rmarkdown html documents this can speed up I/O time considerably. If the dependency does not exist in the target directory and overwrite_dir is FALSE, the parameter is ignored and the directory is overwritten as usual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, other than a few cosmetic issues like too wide lines in NEWS.md and roxygen, &
should be &&
, and missing spaces after if
.
You also need to roxygenize to fix the current errors on Travis.
Thanks!
For the record, the background of this PR is https://stackoverflow.com/q/52337372/559676
@@ -290,6 +291,12 @@ copyDependencyToDir <- function(dependency, outputDir, mustWork = TRUE) { | |||
} else dependency$name | |||
target_dir <- file.path(outputDir, target_dir) | |||
|
|||
# if overwrite is false check to see if the file already exists | |||
if(!overwrite_dir & dir_exists(target_dir)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition dir_exists(target_dir)
may be a little weak. A stronger version is to check if all filenames in the target dir and the dependency object are identical. This makes sure when the dependency is updated (in future versions of the package where the dependency is introduced), you'll get the new version.
Ryan Haunfelder seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This pull request adds the ability to skip overwriting html dependencies if they already exist in the function copyDependenciesToDir. Intended to be used with rmarkdown::render to speed up rendering by decreasing I/O time.