CompUnit::Repository::Installation Reference
CompUnit::Repository::Installation
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method install #
method install(Distribution $distribution, Bool :$force)
Copies modules into a special location so that they can be loaded afterwards. :$force will allow installing over an existing distribution that has the same name, auth, api, and ver. Otherwise such a situation will result in Failure.
method uninstall #
method uninstall(Distribution $distribution)
Removes the $distribution from the repository. $distribution should be obtained from the repository it is being removed from:
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.
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.
method resolve #
method resolve(CompUnit::DependencySpecification $spec --> CompUnit:D)
Returns 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(
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)
Returns CompUnit:D.
Load the $file and return a CompUnit object representing it.
method loaded #
method loaded(--> Iterable:D)
Returns 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 inst.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
5 no-output · 3 not-runnable
class CompUnit::Repository::Installation
does CompUnit::Repository::Locally
does CompUnit::Repository::Installable
{ }Not executed: the documentation states no expected output for this example.
my $inst-repo = CompUnit::RepositoryRegistry.repository-for-name("site");
my $dist = Distribution::Path.new(...);
$inst-repo.install($dist);Not executed: the documentation states no expected output for this example.
my $inst-repo = CompUnit::RepositoryRegistry.repository-for-name("site");
my $dist = $inst-repo.candidates("Acme::Unused").head;
$inst-repo.uninstall($dist);Not executed: the documentation states no expected output for this example.
my $inst-repo-path = CompUnit::RepositoryRegistry.repository-for-name("perl").prefix;
my $inst-repo = CompUnit::Repository::Installation.new(prefix => $inst-repo-path);
my $dist = $inst-repo.candidates("Test").head;
say "Test version: " ~ $dist.meta<ver>; # OUTPUT: «6.d»Neither engine can run this in isolation — the example depends on context from the surrounding text.
# assuming Zef is installed to the default location...
my $repo = CompUnit::RepositoryRegistry.repository-for-name("site");Not executed: the documentation states no expected output for this example.
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»Neither engine can run this in isolation — the example depends on context from the surrounding text.
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»Neither engine can run this in isolation — the example depends on context from the surrounding text.
CompUnit::DependencySpecification $spec, CompUnit::PrecompilationRepository $precomp = self.precomp-repository(), CompUnit::PrecompilationStore :@precomp-stores = self!precomp-stores(), --> CompUnit:D)
Not executed: the documentation states no expected output for this example.