File Coverage

blib/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm
Criterion Covered Total %
statement 31 31 100.0
branch 9 18 50.0
condition 3 9 33.3
subroutine 6 6 100.0
pod 0 2 0.0
total 49 66 74.2


line stmt bran cond sub pod time code
1             # ABSTRACT: Test and build dists with a Makefile.PL
2              
3             use Moose;
4 13     13   108 with(
  13         30  
  13         94  
5             'Dist::Zilla::Role::BuildRunner',
6             'Dist::Zilla::Role::TestRunner',
7             );
8              
9             use Dist::Zilla::Pragmas;
10 13     13   86221  
  13         36  
  13         110  
11             use namespace::autoclean;
12 13     13   121  
  13         36  
  13         176  
13             use Config;
14 13     13   1122  
  13         46  
  13         6472  
15             has 'make_path' => (
16             isa => 'Str',
17             is => 'ro',
18             default => $Config{make} || 'make',
19             );
20              
21             my $self = shift;
22              
23 2     2 0 13 my $make = $self->make_path;
24              
25 2         73 my $makefile = $^O eq 'VMS' ? 'Descrip.MMS' : 'Makefile';
26              
27 2 50       16 return
28             if -e $makefile and (stat 'Makefile.PL')[9] <= (stat $makefile)[9];
29              
30 2 50 33     46 $self->log_debug("running $^X Makefile.PL");
31             system($^X => qw(Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none)) and die "error with Makefile.PL\n";
32 2         45  
33 2 50       458602 $self->log_debug("running $make");
34             system($make) and die "error running $make\n";
35 2         195  
36 2 50       646836 return;
37             }
38 2         98  
39             my ($self, $target, $arg) = @_;
40              
41             my $make = $self->make_path;
42 2     2 0 66 $self->build;
43              
44 2         82 my $job_count = $arg && exists $arg->{jobs}
45 2         22 ? $arg->{jobs}
46             : $self->default_jobs;
47              
48             my $jobs = "j$job_count";
49 2 50 33     392 my $ho = "HARNESS_OPTIONS";
50             local $ENV{$ho} = $ENV{$ho} ? "$ENV{$ho}:$jobs" : $jobs;
51 2         30  
52 2         20 $self->log_debug(join(' ', "running $make test", ( $self->zilla->logger->get_debug ? 'TEST_VERBOSE=1' : () )));
53 2 50       82 system($make, 'test',
54             ( $self->zilla->logger->get_debug || $arg->{test_verbose} ? 'TEST_VERBOSE=1' : () ),
55 2 50       103 ) and die "error running $make test\n";
56              
57 2 50 33     230 return;
    50          
58             }
59              
60 2         1296994 __PACKAGE__->meta->make_immutable;
61             1;
62              
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             Dist::Zilla::Plugin::MakeMaker::Runner - Test and build dists with a Makefile.PL
71              
72             =head1 VERSION
73              
74             version 6.028
75              
76             =head1 PERL VERSION
77              
78             This module should work on any version of perl still receiving updates from
79             the Perl 5 Porters. This means it should work on any version of perl released
80             in the last two to three years. (That is, if the most recently released
81             version is v5.40, then this module should work on both v5.40 and v5.38.)
82              
83             Although it may work on older versions of perl, no guarantee is made that the
84             minimum required version will not be increased. The version may be increased
85             for any reason, and there is no promise that patches will be accepted to lower
86             the minimum required perl.
87              
88             =head1 AUTHOR
89              
90             Ricardo SIGNES 😏 <cpan@semiotic.systems>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2022 by Ricardo SIGNES.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut