blib/lib/Dist/Zilla/Plugin/Author/GETTY/InstallCheck.pm

filter: Statementstmt 100% 35 / 35 Branchbran 64.2% 9 / 14 Conditioncond 44.4% 4 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 76.0% 54 / 71 CC 11 SCAR 19.3
CC
11
Cov
83%
before_release
10.2
__ANON__
3.0
BEGIN
1.0
CRAP 6.9
« .github/dzil-binary/pp-args.pl ↑ Summary blib/lib/Pod/Elemental/Transformer/Author/GETTY.pm »
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
BranchTrueFalseTotal
unless $args->{"command"} and @{$args->{"command"};} 70 2 72
Condition66%2/3
$args->{"command"} and @{$args->{"command"};}
!ll&&!rl&&r
7002
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"};}
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if $status == 0 1 1 2
41  
42 1 ▶ my $why = $status == -1 ? "could not run $cmd[0]: $!"
Branch: 2 branches
BranchTrueFalseTotal
$status == -1 ? : 0 1 1
$status & 127 ? : 0 1 1
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
BranchTrueFalseTotal
$ENV{'HOME'} ? : 1 0 1
Condition33%1/3
$ENV{'PERL_CPANM_HOME'} || ($ENV{'HOME'} ? "$ENV{'HOME'}/.cpanm" : undef)
l!l&&r!l&&!r
010
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)
ABresult
1X1
011
000
46 1 ▶ my $log = $home ? "$home/build.log" : undef;
Branch: 1 branch
BranchTrueFalseTotal
$home ? : 1 0 1
47 1 ▶ my $hint = $log && -e $log ? " See the cpanm log: $log." : '';
Branch: 1 branch
BranchTrueFalseTotal
$log && -e $log ? : 0 1 1
Condition33%1/3
$log and -e $log
!ll&&!rl&&r
010
MC/DC0%0/2
$log and -e $log
$log -e $log
Truth table33%1/3
A and B
A= $logB= -e $log
ABresult
0X0
100
111
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__
« .github/dzil-binary/pp-args.pl ↑ Summary blib/lib/Pod/Elemental/Transformer/Author/GETTY.pm »