| 1 | package Minilla::ModuleMaker::ModuleBuildTiny; | ||||||||||||||||||||||||||||||||||||||||||
| 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 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | no Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Minilla::Util qw(spew_raw); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub generate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my ($self, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | local $Data::Dumper::Useqq = 1; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | local $Data::Dumper::Purity = 1; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $content = get_data_section('Build.PL'); | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my $mt = Text::MicroTemplate->new(template => $content, escape_func => sub { $_[0] }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $src = $mt->build->($project); | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | spew_raw('Build.PL', $src); | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (-d 'bin/') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | warn "[ERROR] Module::Build::Tiny doesn't install bin/ directory. You should rename bin/ to script/\n"; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return 1; # Yes. It's valid project. | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub prereqs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prereqs: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ($self, $project) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my %configure_requires = ( | |||||||||||||||||||||||||||||||||||||||||
| 46 | 'Module::Build::Tiny' => '0.035', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ( @{$project->requires_external_bin || []} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$project->requires_external_bin || []
MC/DC0%0/1
$project->requires_external_bin || []
$project->requires_external_bin
Truth table0%0/2
A
A= $project->requires_external_bin
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $configure_requires{'Devel::CheckBin'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $prereqs = +{ | |||||||||||||||||||||||||||||||||||||||||
| 53 | configure => { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | requires => { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | %configure_requires, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | for my $key (qw(tap_harness_args use_xsutil c_source allow_pureperl)) { | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if( $project->$key ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | die "$key does not supported by " . __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | for my $key (qw(PL_files)) { | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if( $project->$key && ref($project->$key) eq 'HASH' && %{$project->$key} > 0 ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$project->$key and ref $project->$key eq "HASH" and %{$project->$key;} > 0
$project->$key and ref $project->$key eq "HASH"
MC/DC0%0/3
$project->$key and ref $project->$key eq "HASH" and %{$project->$key;} > 0
$project->$key
ref $project->$key eq "HASH"
%{$project->$key;} > 0
Truth table0%0/4
A and B and C
A= $project->$keyB= ref $project->$key eq "HASH"C= %{$project->$key;} > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | die "$key does not supported by " . __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return $prereqs; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub run_tests { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_tests: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | my $harness = TAP::Harness::Env->create({ | ||||||||||||||||||||||||||||||||||||||||||
| 75 | verbosity => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | lib => [ map { rel2abs(catdir(qw/blib/, $_), cwd) } qw/arch lib/ ], | |||||||||||||||||||||||||||||||||||||||||
| 77 | color => -t STDOUT | ||||||||||||||||||||||||||||||||||||||||||
| 78 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my @tests = sort +_find(qr/\.t$/, 't'); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($ENV{RELEASE_TESTING}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @tests, sort +_find(qr/\.t$/, 'xt'); | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $harness->runtests(@tests)->has_errors and die; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub _find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ($pattern, $dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 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
Condition0%0/3
/$pattern/ and -f $_
MC/DC0%0/2
/$pattern/ and -f $_
/$pattern/
-f $_
Truth table0%0/3
A and B
A= /$pattern/B= -f $_
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 94 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||