-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
usethis::proj_set()
instead of usethis::local_project()
Second time writing this commit message since it got lost the first time =( I'm now writing this commit on a text editor window just to be safe. I see that `usethis::local_project()` runs `usethis::proj_set()` twice: first for the new `path`, then inside a `withr::defer()` call that restores the original path. I don't fully understand `withr::defer()`, but it seems to be triggered earlier that I would like it to. That's why I'm seeing on the README, some examples, and the vignette after r-lib/usethis#1108 (comment) paths that are not the one I expected (the one equivalent to `file.path(tempdir(), "biocthisexample")`). One option would be to rely on `usethis::with_project()` to get a similar behavior to what I had with `withr::with_dir()`, however like Jenny Bryan point out, this makes the code confusing for a new user to understand. That's why it seems to me that `usethis::proj_set()` is the better option to use in the examples, README and vignette code. I'm also now using a second example package name in the vignette to avoid clashing with the examples. The code doesn't overwrite the files by default, so if you run the code with the same example twice you don't get to see the output messages the second time.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,8 +44,8 @@ | |
#' ## Create the example package in a temporary location | ||
#' usethis::create_package(pkgdir) | ||
#' | ||
#' ## Set a local project to work with for the examples | ||
#' usethis::local_project(pkgdir) | ||
#' ## Set the project to use for the examples | ||
#' usethis::proj_set(pkgdir) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lcolladotor
Author
Owner
|
||
#' | ||
#' ## Automatically style the example package | ||
#' styler::style_pkg(pkgdir, transformers = biocthis::bioc_style()) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
In normal usage, this will take care of itself, usually. Because
open = rlang::is_interactive()
and will do something sensible, depending on whether user is in RStudio or not. So you may not want to feature this code in the main examples, suggesting that users will need to callproj_set()
themselves. That should be quite rare.