Still create deps.yaml when package not found
Closed this issue · 1 comments
gadenbuie commented
If a package is discovered in the code, but not found locally, make_deps_file()
will error and no file is created. Instead of this, it might be better to filter out the un-found packages, create deps.yaml
with the found packages, and then warn the user about the packages that weren't found.
Here's a reprex of a situation I ran into this morning.
tmpdir <- tempfile("automagic_test_")
dir.create(tmpdir)
cat(
"library(stringr)",
'text_var <- "rstudio::conf()"',
file = file.path(tmpdir, "testing.R"),
sep = "\n"
)
automagic::get_dependent_packages(tmpdir)
#> [,1]
#> [1,] "stringr"
#> [2,] "rstudio"
automagic::make_deps_file(tmpdir)
#> Warning in packageDescription(pkg_name): no package 'rstudio' was found
#> Error: $ operator is invalid for atomic vectors
Created on 2019-03-08 by the reprex package (v0.2.1)
cole-brokamp commented
thanks. this raises an important issue of if a package just isn't installed or doesn't exist at all. for now, i've set it up to not fail, but warn the user.