This part of the code search the repo for all files with file extension .pkg. That means that a list/vector of file will be passed to get_pkg_metadata() if multiple files with that file extension exists.
However, this file will have different names depending on what the package name is so it might be difficult to make this completely error proof. I can't think of a better way to solve this than to list all files in the /src/ folder with format .pkg and throw a helpful error if that folder does not contain exactly one file with that pattern. That error message will show in the Actions log. Which not everyone will be able to find, but I think that is the best we can do.
find_file_in_pkg()
returns a list/vector of files that match the file pattern if more than one file match that pattern.https://github.com/arthur-shaw/adodown/blob/6d5ed941202c274248a3ffcd9f484a80593a85cb/R/metadata.R#L1-L14
This part of the code search the repo for all files with file extension
.pkg
. That means that a list/vector of file will be passed toget_pkg_metadata()
if multiple files with that file extension exists.https://github.com/arthur-shaw/adodown/blob/6d5ed941202c274248a3ffcd9f484a80593a85cb/R/initialize.R#L36-L41
Passing a list/vector of files will create an error here:
https://github.com/arthur-shaw/adodown/blob/6d5ed941202c274248a3ffcd9f484a80593a85cb/R/metadata.R#L18-L21
Since we know the
.pkg
file will be located in/src/
(see https://github.com/lsms-worldbank/adodown/blob/main/src/adodown.pkg), I think we should look for the file only there.However, this file will have different names depending on what the package name is so it might be difficult to make this completely error proof. I can't think of a better way to solve this than to list all files in the
/src/
folder with format.pkg
and throw a helpful error if that folder does not contain exactly one file with that pattern. That error message will show in the Actions log. Which not everyone will be able to find, but I think that is the best we can do.I admit this wont be a common error, but I ran into it when I tried to set this up for https://github.com/lsms-worldbank/adodown as the template folder has this template package file: https://github.com/lsms-worldbank/adodown/blob/main/src/ado/templates/ad-package.pkg.