Install

=title class Zef::Install
=subtitle A configurable implementation of the Installer interface

Synopsis

    use Zef;
    use Zef::Install;
    use Zef::Distribution::Local;
    # Setup with a single installer backend
    my $installer = Zef::Install.new(
        backends => [
            { module  => "Zef::Service::InstallRakuDistribution" },
        ],
    );
    # Assuming our current directory is a raku distribution...
    my $dist-to-install = Zef::Distribution::Local.new($*CWD);
    my $candidate       = Candidate.new(dist => $dist-to-install);
    my $install-to-repo = CompUnit::RepositoryRegistry.repository-for-name("site");
    # ...install the distribution using the first available backend
    my $installed = so $installer.install($candidate, :cur($install-to-repo));
    say $installed ?? 'Install OK' !! 'Something went wrong...';

Description

An Installer class that uses 1 or more other Installer instances as backends. It abstracts the logic to do 'install this distribution with the first backend that supports the given distribution'.

Methods

method install-matcher

method install-matcher(Zef::Distribution $dist --> Bool:D)

Returns True if any of the probeable self.plugins know how to install $dist.

method install

method install(Candidate $candi, CompUnit::Repository :$cur!, Bool :$force, Bool :$precompile, Supplier :$logger, Int :$timeout --> Bool:D)

Installs the distribution $candi.dist to $cur (see synopsis). Set $force to True to allow installing a distribution that is already installed. If $precompile is False then it will not precompile during installation.

An optional :$logger can be supplied to receive events about what is occurring.

An optional :$timeout can be passed to denote the number of seconds after which we'll assume failure.

Returns True if the installation succeeded.

Note In the future this might have backends allowing installation of e.g. Python modules for things using Inline::Python.

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