CompUnit::Repository::Installation
does CompUnit::Repository::Locallydoes CompUnit::Repository::Installable
A CompUnit::Repository implementation backed by the filesystem, but uses an internal storage format to:
Handle case sensitivity issues on filesystems that may conflict as a CompUnit::Repository::FileSystem
.
Handle allowable filename issues (e.g. unicode) on filesystems that don't support them.
Allow multiple distributions with the same name, but with different ver
and/or auth
and/or api
values, to be installed and separately accessible in a single repository.
Enable faster module loading by providing module precompilation.
Because of the internal storage format the usual way to add a distribution is not by copying files but by calling CompUnit::Repository::Installation#method_install.
method install(Distribution , Bool :)
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.
my = CompUnit::RepositoryRegistry.repository-for-name("site");my = Distribution::Path.new(...);.install();
method uninstall(Distribution )
Removes the $distribution
from the repository. $distribution
should be obtained from the repository it is being removed from:
my = CompUnit::RepositoryRegistry.repository-for-name("site");my = .candidates("Acme::Unused").head;.uninstall();
multi method candidates(Str , :, :, :)multi method candidates(CompUnit::DependencySpecification )
Return all distributions that contain a module matching the specified $name
, auth
, ver
, and api
.
my = CompUnit::RepositoryRegistry.repository-for-name("perl").prefix;my = CompUnit::Repository::Installation.new(prefix => );my = .candidates("Test").head;say "Test version: " ~ .meta<ver>; # OUTPUT: «6.d»
multi method files(Str , :, :, :)multi method files(CompUnit::DependencySpecification )
Return all distributions that match the specified auth
ver
and api
, and contains a non-module file matching the specified $name
.
# assuming Zef is installed to the default location...my = CompUnit::RepositoryRegistry.repository-for-name("site");say .files('bin/zef', :ver<419.0+>).head.<name> // "Nada"; # OUTPUT: «Nada»say .files('resources/config.txt', :ver<419.0+>).head.<name> // "Nada"; # OUTPUT: «Nada»say .files('bin/zef', :ver<0.4.0+>).head.<name>; # OUTPUT: «zef»say .files('resources/config.txt', :ver<0.4.0+>).head.<name>; # OUTPUT: «zef»
method resolve(CompUnit::DependencySpecification --> CompUnit)
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(CompUnit::DependencySpecification ,CompUnit::PrecompilationRepository = self.precomp-repository(),CompUnit::PrecompilationStore : = self!precomp-stores(),--> CompUnit)
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(IO::Path --> CompUnit)
Load the $file
and return a CompUnit object representing it.
method loaded(--> Iterable)
Returns all CompUnits this repository has loaded.
method short-id()
Returns the repo short-id, which for this repository is inst
.