class CompUnit::Repository::FileSystem

CompUnit::Repository::FileSystem

class CompUnit::Repository::FileSystem
    does CompUnit::Repository::Locally
    does CompUnit::Repository
    { }

A CompUnit::Repository implementation backed by the filesystem typically used in development situations. This is what is used by -I . / -I lib (which are actually -I file#. and -I file#lib) or use lib "." / use lib "lib". Unlike CompUnit::Repository::Installation, this represents a single distribution.

Methods

method candidates

multi method candidates(Str:D $name:$auth:$ver:$api)
multi method candidates(CompUnit::DependencySpecification $spec)

Return all distributions that contain a module matching the specified $name, auth, ver, and api.

# assuming one is cloned into the zef git repository... 
my $repo = CompUnit::Repository::FileSystem.new(prefix => $*CWD);
with $repo.candidates("Zef").head -> $dist {
    say "Zef version: " ~ $dist.meta<version>;
}
else {
    say "No candidates for 'Zef' found";
}

method files

multi method files(Str:D $name:$auth:$ver:$api)
multi method files(CompUnit::DependencySpecification $spec)

Return all distributions that match the specified auth ver and api, and contains a non-module file matching the specified $name.

# assuming one is cloned into the zef git repository... 
my $repo = CompUnit::Repository::FileSystem.new(prefix => $*CWD);
say $repo.files('bin/zef':ver<419.0+>).head.<name>              // "Nada"# OUTPUT: «Nada␤» 
say $repo.files('resources/config.txt':ver<419.0+>).head.<name> // "Nada"# OUTPUT: «Nada␤» 
 
say $repo.files('bin/zef':ver<0.4.0+>).head.<name>;                        # OUTPUT: «zef␤» 
say $repo.files('resources/config.txt':ver<0.4.0+>).head.<name>;           # OUTPUT: «zef␤»

method resolve

method resolve(CompUnit::DependencySpecification $spec --> CompUnit:D)

Returns a CompUnit mapped to the highest version distribution matching $spec from the first repository in the repository chain that contains any version of a distribution matching $spec.

method need

    method need(
        CompUnit::DependencySpecification $spec,
        CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
        CompUnit::PrecompilationStore :@precomp-stores = self!precomp-stores(),
        --> CompUnit:D)

Loads and returns a CompUnit which is mapped to the highest version distribution matching $spec from the first repository in the repository chain that contains any version of a distribution matching $spec.

method load

method load(IO::Path:D $file --> CompUnit:D)

Load the $file and return a CompUnit object representing it.

method loaded

method loaded(--> Iterable:D)

Returns all CompUnits this repository has loaded.

method short-id

method short-id()

Returns the repo short-id, which for this repository is file.

Type Graph

Type relations for CompUnit::Repository::FileSystem
perl6-type-graph CompUnit::Repository::FileSystem CompUnit::Repository::FileSystem Any Any CompUnit::Repository::FileSystem->Any CompUnit::Repository::Locally CompUnit::Repository::Locally CompUnit::Repository::FileSystem->CompUnit::Repository::Locally CompUnit::Repository CompUnit::Repository CompUnit::Repository::FileSystem->CompUnit::Repository Mu Mu Any->Mu

Expand above chart

Routines supplied by role CompUnit::Repository

CompUnit::Repository::FileSystem does role CompUnit::Repository, which provides the following routines:

(CompUnit::Repository) method resolve

method resolve(CompUnit::DependencySpecification $spec --> CompUnit:D)

Returns a CompUnit mapped to the highest version distribution matching $spec from the first repository in the repository chain that contains any version of a distribution matching $spec.

(CompUnit::Repository) method need

Loads and returns a CompUnit which is mapped to the highest version distribution matching $spec from the first repository in the repository chain that contains any version of a distribution matching $spec.

(CompUnit::Repository) method load

method load(IO::Path:D $file --> CompUnit:D)

Load the $file and return a CompUnit object representing it.

(CompUnit::Repository) method loaded

method loaded(--> Iterable:D)

Returns all CompUnits this repository has loaded.