Minilla/ModuleMaker/ExtUtilsMakeMaker.pm

filter: Statementstmt 54.0% 40 / 74 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 65.0% 13 / 20 Podpod 0.0% 0 / 3 totaltotal 46.4% 53 / 114 CC 9 SCAR 16.7
CC
9
Cov
45%
prereqs
12.0
run_tests
12.0
__ANON__
12.0
CRAP 5.3
« Minilla/Release/CheckChanges.pm ↑ Summary Minilla/CLI/Install.pm »
1 package Minilla::ModuleMaker::ExtUtilsMakeMaker;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Data::Section::Simple qw(get_data_section);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Text::MicroTemplate qw(render_mt);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec::Functions qw(catdir rel2abs);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use File::Find ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use TAP::Harness::Env;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # This module is EXPERIMENTAL.
14 # You can use this. But I may change the behaviour...
15  
16 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Minilla::Util qw(spew_raw);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 0 ▶sub generate {
Subroutine generate: not called CC=1 SCAR=6.9
Pod undocumented
23 0 my ($self, $project) = @_;
24  
25 0 local $Data::Dumper::Terse = 1;
26 0 local $Data::Dumper::Useqq = 1;
27 0 local $Data::Dumper::Purity = 1;
28 0 local $Data::Dumper::Indent = 1;
29 0 local $Data::Dumper::Sortkeys = 1;
30 0 my $content = get_data_section('Makefile.PL');
31 0 ▶ my $mt = Text::MicroTemplate->new(template => $content, escape_func => sub { $_[0] });
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 my $src = $mt->build->($project);
33 0 spew_raw('Makefile.PL', $src);
34 }
35  
36 0 ▶sub prereqs {
Subroutine prereqs: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my ($self, $project) = @_;
38  
39 0 my %configure_requires = (
40 'ExtUtils::MakeMaker' => $self->_eumm_minimum_version($project),
41 );
42  
43 0 my $prereqs = +{
44 configure => {
45 requires => {
46 %configure_requires,
47 }
48 }
49 };
50  
51 0 for my $key (qw(tap_harness_args use_xsutil c_source allow_pureperl requires_external_bin)) {
52 0 ▶ if( $project->$key ){
Branch: 1 branch
BranchTrueFalseTotal
if ($project->$key) 0 0 0
53 0 die "$key does not supported by " . __PACKAGE__;
54 }
55 }
56 0 return $prereqs;
57 }
58  
59 0 ▶sub _eumm_minimum_version {
Subroutine _eumm_minimum_version: not called CC=2 SCAR=17.9
60 0 my ($self, $project) = @_;
61  
62 0 ▶ if (@{ $project->unsupported->os }) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$project->unsupported->os;}) 0 0 0
63 0 return '7.26'; # os_unsupported
64 }
65 0 return '6.64'; # TEST_REQUIRES (and MYMETA)
66 }
67  
68 0 ▶sub run_tests {
Subroutine run_tests: not called CC=3 SCAR=24.8
Pod undocumented
69 my $harness = TAP::Harness::Env->create({
70 verbosity => 0,
71 0 lib => [ map { rel2abs(catdir(qw/blib/, $_), cwd) } qw/arch lib/ ],
72 color => -t STDOUT
73 });
74 0 my @tests = sort +_find(qr/\.t$/, 't');
75 0 ▶ if ($ENV{RELEASE_TESTING}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"RELEASE_TESTING"}) 0 0 0
76 0 push @tests, sort +_find(qr/\.t$/, 'xt');
77 }
78 0 ▶ $harness->runtests(@tests)->has_errors and die;
Branch: 1 branch
BranchTrueFalseTotal
$harness->runtests(@tests)->has_errors and die 0 0 0
79 }
80  
81 0 ▶sub _find {
Subroutine _find: not called CC=2 SCAR=17.9
82 0 my ($pattern, $dir) = @_;
83 0 my @ret;
84 0 ▶ File::Find::find(sub { push @ret, $File::Find::name if /$pattern/ && -f }, $dir) if -d $dir;
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
if -d $dir 0 0 0
if /$pattern/ and -f $_ 0 0 0
Condition0%0/3
/$pattern/ and -f $_
!ll&&!rl&&r
000
MC/DC0%0/2
/$pattern/ and -f $_
/$pattern/ -f $_
Truth table0%0/3
A and B
A= /$pattern/B= -f $_
ABresult
0X0
100
111
85 0 return @ret;
86 }
87  
88 1 1;
89 __DATA__
« Minilla/Release/CheckChanges.pm ↑ Summary Minilla/CLI/Install.pm »