Ecosystems

=title class Zef::Repository::Ecosystems
=subtitle A simple json database based implementation of the Repository interface

Synopsis

    use Zef::Fetch;
    use Zef::Repository::Ecosystems;
    my @fetching_backends = [
        { module => "Zef::Service::Shell::curl" },
        { module => "Zef::Service::Shell::wget" },
    ];
    my @mirrors = 'https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/11efd9077b398df3766eaa7cf8e6a9519f63c272/cpan.json';
    my $fetcher = Zef::Fetch.new(:backends(@fetching_backends));
    my $cache   = $*HOME.child(".zef/store") andthen { mkdir $_ unless $_.IO.e };
    my $repo    = Zef::Repository::Ecosystems.new(name => "cpan", :$fetcher, :$cache, :@mirrors);
    # Print out all available distributions from this repository
    say $_.dist.identity for $repo.available;

Description

A basic Repository that uses a file (containing an array of hash / META6 json) as a database. It is used for the default 'fez', 'p6c', and 'cpan' ecosystems, and is also a good choice for ad-hoc darkpans by passing it your own mirrors in the config.

Methods

method search(Bool :$strict, *@identities ($, *@), *%fields --> Array[Candidate])

Resolves each identity in @identities to all of its matching Candidates. If $strict is False then it will consider partial matches on module short-names (i.e. 'zef search HTTP' will get results for e.g. HTTP::UserAgent).

method available

method available(*@plugins --> Array[Candidate])

Returns an Array of all Candidate provided by this repository instance (i.e. all distributions in the cpan ecosystem).

method update

method update(Supplier :$stdout = Supplier.new, Supplier :$stderr = Supplier.new --> Nil)

Attempts to update the local file / database using the first of @.mirrors that successfully fetches. A Supplier can be supplied as :$stdout and :$stderr to receive any output.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.