The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::BrewBuild - Perl/Berry brew unit testing automation across installed perl versions (Windows and Unix).

Coverage Status

DESCRIPTION

This module is the backend for the brewbuild script that is accompanied by this module. For almost all cases, you should be using that script instead of using this module directly (so go read that documentation for real use cases), as this module is just a helper for the installed script, and isn't designed for end-user use.

It provides you the ability to perform your unit tests across all of your Perlbrew (Unix) or Berrybrew (Windows) Perl instances.

For Windows, you'll need to install Berrybrew (see "SEE ALSO" for details). For Unix, you'll need Perlbrew.

It allows you to remove and reinstall on each test run, install random versions of perl, or install specific versions.

All unit tests are run against all installed instances.

SYNOPSIS

    use Test::BrewBuild;

    # default settings

    my %args = (
        debug   => undef,
        remove  => undef,
        version => undef,
        new     => undef,
        plugin  => undef,
        on      => undef,
    );

    my $bb = Test::BrewBuild->new(%args);

    my @perls_available = $bb->perls_available;
    my @perls_installed = $bb->perls_installed;

    # remove all currently installed instances of perl, less the one you're
    # using

    $bb->instance_remove;

    # install a specific version (uses 'version' param, or 'new'. If 'new'
    # is set to a positive integer, we'll randomly install that many instances)

    $bb->instance_install;

    # execute across all perl instances, and dump the output

    $bb->run;

METHODS

new(%args)

Returns a new Test::BrewBuild object. See the documentation for the berrybrew script to understand what the arguments are and do.

plugin('Module::Name')

Fetches and installs a custom plugin which contains the code that perlbrew/berrybrew exec will execute. If not used or the module specified can't be located (or it contains errors), we fall back to the default bundled Test::BrewBuild::Plugin::DefaultExec (which is the canonical example for writing new plugins).

Note that you can send in a custom plugin *.pm filename to plugin as opposed to a module name if the module isn't installed. If the file isn't in the current working directory, send in the relative or full path.

perls_available

Returns an array containing all perls available, whether already installed or not.

perls_installed

Returns an array of the names of all perls currently installed under your *brew setup.

instance_install

If 'version' param is set, will install that specific version. If 'new' param is set to a positive integer, will install that many random versions of perl.

instance_remove

Uninstalls all currently installed perls, less the one you are currently 'switch'ed or 'use'd to.

run

Prepares the run and calls exec() to run all tests against all installed perls.

results

Only called by run(). Processes and displayes test results.

exec

Generates the test executable in a format ready to run against all installed perls, and processes it against *brew exec.

is_win

Helper method, returns true if the current OS is Windows, false if not.

brew_info

Helper method, returns the appropriate *brew calls relative to the platform we're working on.

log

Developer method, returns an instance of the packages log object for creating child log objects.

AUTHOR

Steve Bertrand, <steveb at cpan.org>

CONTRIBUTING

Any and all feedback and help is appreciated. A Pull Request is the preferred method of receiving changes (https://github.com/stevieb9/p5-test-brewbuild), but regular patches through the bug tracker, or even just email discussions are welcomed.

BUGS

https://github.com/stevieb9/p5-test-brewbuild/issues

SUPPORT

You can find documentation for this module and its accompanying script with the perldoc command:

    perldoc Test::BrewBuild

    perldoc brewbuild

SEE ALSO

Berrybrew for Windows:

https://github.com/dnmfarrell/berrybrew

Perlbrew for Unixes:

http://perlbrew.pl

LICENSE AND COPYRIGHT

Copyright 2016 Steve Bertrand.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.