This PR addresses the warning message mentioned in #118 when installing multiple packages with p_install_gh().
The code in R/p_install_gh.R#L24 throws a warning message when passing a vector of repository names to the package argument: p_install_gh(c('path/package', 'path2/repo'))
Warning message:
if (p_loaded(char = package)):
the condition has length > 1 and only the first element will be used
I propose the following changes:
If clause should check for an array of booleans instead of a single boolean.
Because p_loaded() is using the package name to check, whether that package is loaded, the package name should be extracted from the Github path beforehand with parse_git_repo(). (Because p_install_gh() passes a Github path (e.g. 'trinker/pacman') to p_loaded(). p_loaded() always returns FALSE for Github paths.)
Coverage remained the same at 0.0% when pulling 44ceb33d9b7c9746f168789022f7b014bfc1a99f on LoHertel:fix-install-gh into fc09ccd2405e539dec575dbdf7832df82082d4e0 on trinker:master.
This PR addresses the warning message mentioned in #118 when installing multiple packages with
p_install_gh()
.The code in
R/p_install_gh.R#L24
throws a warning message when passing a vector of repository names to thepackage
argument:p_install_gh(c('path/package', 'path2/repo'))
I propose the following changes:
p_loaded()
is using the package name to check, whether that package is loaded, the package name should be extracted from the Github path beforehand withparse_git_repo()
. (Becausep_install_gh()
passes a Github path (e.g. 'trinker/pacman') top_loaded()
.p_loaded()
always returnsFALSE
for Github paths.)parse_git_repo()
inR/utils.R#L194
from theremotes
package. It would act as an interface to call eitherremotes::parse_github_url()
orremotes::parse_repo_spec()
. The code forparse_git_repo()
is taken fromremotes/R/parse-git.R#L97
.parse_git_repo()
depends onviapply()
, therefore it is included fromremotes/R/utils.R#L8
as well.