-
Notifications
You must be signed in to change notification settings - Fork 11
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
Install missing packages in a local library #262
Conversation
maurolepore
commented
Dec 13, 2024
•
edited
Loading
edited
- Fix what's commented at Avoid evaluating {dverse} in the title #261 (comment)
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.
(outdated)
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.
(outdated)
inst/WORDLIST.txt
Outdated
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.
I didn't sort to keep the diff easier to read. Happy to sort it though.
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.
🤞 😄
You need: | ||
|
||
* the package {dverse} to <u>d</u>ocument your uni<u>verse</u>, | ||
* each package in the toy 'admiralverse' to access the documentation metadata, | ||
* {dplyr} to manipulate the output of {dverse}, and | ||
* {DT} to create a searchable table. | ||
|
||
```{r dependencies} | ||
#| echo: false | ||
#| message: false | ||
|
||
# Ensure the packages used here are installed; else install them in a local | ||
# library to avoid forcing new dependencies in the system of the blog | ||
# administrators | ||
|
||
local_library <- tempfile() | ||
dir.create(local_library) | ||
# https://adv-r.hadley.nz/functions.html#on-exit | ||
on.exit(unlink(local_library), add = TRUE, after = FALSE) | ||
|
||
.libPaths(c(.libPaths(), local_library)) | ||
|
||
if (!requireNamespace("pak", quietly = TRUE)) { | ||
install.packages("pak", lib = local_library) | ||
} | ||
# The cache is smart. It won't re-install what's already available | ||
pak::pak(c("dverse", admiralverse, "dplyr", "DT"), lib = local_library) | ||
``` |
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.
Here I ensure that the packages I need are installed; else I install them in a local library to be polite -- I want to avoid forcing new dependencies in your system.
Let me know if you do prefer me to install them at a more general level, maybe in the Dockerfile?
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.
We install them as part of a workflow - I have added them now and so can close this PR :) blog is live!