FileReporter

=title class Zef::Service::FileReporter
=subtitle A basic save-to-file based implementation of the Reporter interface

Synopsis

    use Zef;
    use Zef::Distribution::Local;
    use Zef::Service::FileReporter;
    my $reporter = Zef::Service::FileReporter.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
    my $dist = Zef::Distribution::Local.new($*CWD);
    my $candidate = Candidate.new(:$dist);
    my $reported = so $reporter.report($candidate, :$stdout, :$stderr);
    say $reported ?? "Report Success" !! "Report Failure";

Description

Reporter class that serves as an example of a reporter.

Note this doesn't yet save e.g. test output in a way that can be recorded, such as attaching it to Candidate or to a temp file linked to that Candidate.

Methods

method probe

method probe(--> Bool:D)

Always returns True since this is backed by IO::Path.

method report

method report(Candidate $candi, Supplier $stdout, Supplier $stderr --> Bool:D)

Given $candi it will save various information including the distribution meta data, system information, if the tests passed, and (in the future, so nyi) test output. A Supplier can be supplied as :$stdout and :$stderr to receive any output.

Returns True if the report data was saved successfully.

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