| 1 | package Dist::Zilla::Plugin::Author::GETTY::InstallCheck; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Test-install the release tarball with cpanm before it is uploaded | ||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 13 | with 'Dist::Zilla::Role::BeforeRelease'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 13 | our $VERSION = '0.328'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | has command => ( | ||||||||||||||||||||||||||||
| 10 | is => 'ro', | ||||||||||||||||||||||||||||
| 11 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 12 | 70 | ▶ | default => sub { [ 'cpanm', '--test-only' ] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 13 | ); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 72 | ▶ | sub mvp_multivalue_args { qw( command ) } | ||||||||||||||||||||||||||
|
Subroutine
mvp_multivalue_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 72 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 18 | 72 | my ($orig, $class, @args) = @_; | |||||||||||||||||||||||||||
| 19 | 72 | my $args = $class->$orig(@args); | |||||||||||||||||||||||||||
| 20 | 72 | ▶ | delete $args->{command} unless $args->{command} && @{ $args->{command} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"command"} and @{$args->{"command"};}
MC/DC50%1/2
$args->{"command"} and @{$args->{"command"};}
$args->{"command"}
@{$args->{"command"};}
Truth table66%2/3
A and B
A= $args->{"command"}B= @{$args->{"command"};}
| |||||||||||||||||||||||||||||
| 21 | 72 | return $args; | |||||||||||||||||||||||||||
| 22 | 13 | }; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | ▶ | sub before_release { | ||||||||||||||||||||||||||
|
Subroutine
before_release: called CC=9 SCAR=23.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 2 | my ($self, $archive) = @_; | |||||||||||||||||||||||||||
| 26 | 2 | my $tarball = $archive->absolute->stringify; | |||||||||||||||||||||||||||
| 27 | 2 | my @cmd = (@{ $self->command }, $tarball); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | $self->log("testing the release tarball with $cmd[0] before the upload: $tarball"); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | my $status; | |||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||
| 33 | 2 | local $ENV{RELEASE_TESTING}; | |||||||||||||||||||||||||||
| 34 | 2 | local $ENV{AUTHOR_TESTING}; | |||||||||||||||||||||||||||
| 35 | 2 | delete $ENV{RELEASE_TESTING}; | |||||||||||||||||||||||||||
| 36 | 2 | delete $ENV{AUTHOR_TESTING}; | |||||||||||||||||||||||||||
| 37 | 2 | $status = system { $cmd[0] } @cmd; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | return if $status == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | ▶ | my $why = $status == -1 ? "could not run $cmd[0]: $!" | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 43 | : $status & 127 ? "$cmd[0] died of signal " . ($status & 127) | ||||||||||||||||||||||||||||
| 44 | : "$cmd[0] exited with " . ($status >> 8); | ||||||||||||||||||||||||||||
| 45 | 1 | ▶ | my $home = $ENV{PERL_CPANM_HOME} || ($ENV{HOME} ? "$ENV{HOME}/.cpanm" : undef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{'PERL_CPANM_HOME'} || ($ENV{'HOME'} ? "$ENV{'HOME'}/.cpanm" : undef)
MC/DC0%0/2
$ENV{'PERL_CPANM_HOME'} || ($ENV{'HOME'} ? "$ENV{'HOME'}/.cpanm" : undef)
$ENV{'PERL_CPANM_HOME'}
($ENV{'HOME'} ? "$ENV{'HOME'}/.cpanm" : undef)
Truth table33%1/3
A || B
A= $ENV{'PERL_CPANM_HOME'}B= ($ENV{'HOME'} ? "$ENV{'HOME'}/.cpanm" : undef)
| |||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my $log = $home ? "$home/build.log" : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | my $hint = $log && -e $log ? " See the cpanm log: $log." : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$log and -e $log
MC/DC0%0/2
$log and -e $log
$log
-e $log
Truth table33%1/3
A and B
A= $logB= -e $log
| |||||||||||||||||||||||||||||
| 48 | 1 | $self->log_fatal("The install test of $tarball failed ($why); nothing was uploaded.$hint"); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 13 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 52 | 13 | 1; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||||||||||