japhb Getting myself very confused, so could use expert advice. I'm trying to understand the CUR API, and there's a files method that supposedly should find me distros that include a file with a certain name. I can use it to search for a bin/ file in one of my installed dists, but I can't seem to get any result looking for a resources/ file. 21:19
For example, this works: for $*REPO.repo-chain -> $repo { with $repo.?files('bin/mugs-cli') { say $_.raku } }
(${:api(v0), :auth(""), :checksum(Str), :source("8F495836A3872E644F6D35F6A512D447ACDD4DF4"), :ver(v0.0.2)},).Seq
(Although I expected an fully specified source, not the single hash there.) 21:20
But this does not: for $*REPO.repo-chain -> $repo { with $repo.?files('resources/conf/user-defaults.yaml') { say $_.raku } }
I assume I'm Holding It Wrong, but I'm kinda stuck. Any pointers? 21:21
(FWIW, I looked through my site install tree and actually found the YAML file in question, so it's clearly been installed.) 21:22
codesections japhb: I haven't gone that deep into CUR (yet), so this could be entirely wrong. But wouldn't you get to files in resources with $repo.resource rather than $repo.files? (github.com/rakudo/rakudo/blob/mast...L590-L594) 21:45
japhb codesections: I'm actually trying to see if it's possible to find all dists that have a certain file in them, rather than trying to find the contents of a given resource file in a given dist. I was researching ways to write a plugin system, and one of the ideas I had was for plugin dists to include a special resource file that listed the plugins that dist provides, and searching for all dists that had 22:14
that file.
codesections I still meant walking the repo chain, though. Something like: $*REPO.repo-chain -> $repo { with $repo.?resource('resources/conf/user-defaults.yaml') { say $_.raku } } 22:26
I would have thought that'd give you the list you're talking about, but I could be misunderstanding (either what that would give you or what you want) 22:28
nine japhb: files is just not meant for finding resources 22:50
ugexe eh, i was leaning more towards bug
nine I may of course just be wrong :) 22:51
ugexe github.com/rakudo/rakudo/blob/c5d6...#L198-L199 i would have expected that to catch it, but it doesnt appear to do so
ah thats for CURFS 22:52
so with -I. or -Ilib .files(...) will find resources
japhb: for CURI you can call .files("resources/.../foo.json", :name($name-of-dist)), although it requiring the :name seems like it might be a bug (CURFS can do it, so i would expect CURI to) 22:57
japhb ugexe: Ah, OK. So I had interpreted the API OK at least. 23:00
ugexe github.com/rakudo/rakudo/blob/c5d6...n.pm6#L361 this multi just needs to be reworked to iterated `self.installed` instead of `self.candidates(...)` when $file starts with `resource/` i think 23:05
using .candidates is a fast path though, which we want for bin/ files 23:06