InstallRakuDistribution
=title class Zef::Service::InstallRakuDistribution
=subtitle A raku CompUnit::Repository based implementation of the Installer interface
Synopsis
use Zef;
use Zef::Service::InstallRakuDistribution;
my $installer = Zef::Service::InstallRakuDistribution.new;
# Add logging if we want to see output
my $stdout = Supplier.new;
my $stderr = Supplier.new;
$stdout.Supply.tap: { say $_ };
$stderr.Supply.tap: { note $_ };
# Assuming our current directory is a raku distribution
# with no dependencies or all dependencies already installed...
my $dist-to-install = Zef::Distribution::Local.new($*CWD);
my $cur = CompUnit::RepositoryRegistry.repository-for-name("site"); # default install location
my $passed = so $installer.install($dist-to-test, :$cur, :$stdout, :$stderr);
say $passed ?? "PASS" !! "FAIL";
Description
Installer
class for handling raku Distribution
installation (it installs raku modules).
You probably never want to use this unless its indirectly through Zef::Install
.
Methods
method probe
method probe(--> Bool:D)
Returns True
if this module believes all run time prerequisites are met. Since the only prerequisite
is $*EXECUTABLE
this always returns True
.
method install-matcher
method install-matcher(Distribution $ --> Bool:D) { return True }
Returns True
if this module knows how to install the given Distribution
.
Note: This always returns True
right now, but may not in the future if zef learns how to
install packages from other languages (such as perl via a cpanm wrapper).
method install
method install(Distribution $dist, CompUnit::Repository :$cur, Bool :$force, Bool :$precompile, Supplier $stdout, Suppluer :$stderr --> Bool:D)
Install the distribution $dist
to the CompUnit::Repository $cur
. If $force
is True
then it will allow reinstalling an already installed distribution. If $precompile
is False
then it will not precompile during installation. A Supplier
can be supplied as :$stdout
and :$stderr
to receive any output.
Returns True
if the install succeeded.