Local
=title class Zef::Distribution::Local
=subtitle A local file system Distribution implementation
Synopsis
use Zef::Distribution::Local;
my $dist = Zef::Distribution::Local.new($*CWD);
# Show the meta data
say $dist.meta.raku;
# Output the content of the first item in provides
with $dist.meta<provides>.hash.values.head -> $name-path {
say $dist.content($name-path).open.slurp;
}
# Output if the $dist contains a namespace matching Foo::Bar:ver<1>
say $dist.contains-spec("Foo::Bar:ver<1>");
Description
A Distribution implementation that is used to represent locally downloaded and extracted distributions.
Methods
method new
method new(IO() $path)
Create a Zef::Distribution::Local from a local distribution via its META6.json file.
If $path is a directory then it will assume there is a META6.json file it can use.
If $path is a file it will assume it a json file containing meta data (formatted like META6.json).
method meta
method meta(--> Hash:D)
Returns the meta data that represents the distribution.
method content
method content($name-path --> IO::Handle:D)
Returns an unopened IO::Handle that can be used to get the content of the $name-path, where $name-path
is a value of the distributions provides e.g. lib/Foo.rakumod, $dist.content($dist.meta<provides>{"Foo"}).