misc/cpan/MyBuilder.pm

filter: Statementstmt 72.1% 57 / 79 Branchbran 65.3% 17 / 26 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 75.0% 12 / 16 Podpod 0.0% 0 / 5 totaltotal 69.4% 91 / 131 CC 17 SCAR 13.2
CC
17
Cov
71%
lexpand
6.0
my_cpanfile_specs
6.0
dist_version
6.0
CRAP 3.7
« blib/lib/YATT/Lite/Site/Registry.pm ↑ Summary blib/lib/YATT/Lite/XHF/Dumper.pm »
1 package
2 MyBuilder;
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Basename ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Module::Build File::Spec);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Module::CPANfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub lexpand {
Subroutine lexpand: not called CC=2 SCAR=17.9
Pod undocumented
14 0 ▶ return unless defined $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] 0 0 0
15 0 %{$_[0]};
16 }
17  
18 0 ▶sub my_cpanfile_specs {
Subroutine my_cpanfile_specs: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my ($pack) = @_;
20 0 my $file = Module::CPANfile->load("cpanfile");
21 0 my $prereq = $file->prereq_specs;
22 0 my %args;
23 0 %{$args{requires}} = lexpand($prereq->{runtime}{requires});
24 0 foreach my $phase (qw/configure runtime build test/) {
25 0 %{$args{$phase . "_requires"}} = lexpand($prereq->{$phase}{requires});
26 }
27 0 %{$args{recommends}} = (map {lexpand($prereq->{$_}{recommends})}
28 keys %$prereq);
29 0 %args
30 }
31  
32 #
33 # To include yatt_dist as_is
34 #
35 1 ▶sub process_yatt_dist_files {
Subroutine process_yatt_dist_files: called CC=2 SCAR=6.9
Pod undocumented
36 1 my ($self) = @_;
37  
38 1 $self->pm_files(\ my %pm_files);
39 1 $self->pod_files(\ my %pod_files);
40 1 $self->script_files(\ my %script_files);
41  
42 1 foreach my $desc ([pm => \%pm_files], [pod => \%pod_files]) {
43 2 my ($ext, $map) = @$desc;
44 2 my ($src, $dest) = ("Lite.$ext", "lib/YATT/Lite.$ext");
45 2 $map->{$src} = $dest;
46 2 $self->_yatt_dist_ensure_blib_copied($src, $dest);
47 }
48  
49 # Lite/ should go into blib/lib/YATT/Lite
50 134 ▶ find({no_chdir => 1, wanted => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
51 134 ▶ return $self->prune if /^\.git|^lib$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\.git|^lib$/ 0 134 134
52 134 ▶ return if -d $_;
Branch: 1 branch
BranchTrueFalseTotal
if -d $_ 18 116 134
53 116 my $dest;
54 116 ▶ if (/\.pm$/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\.pm$/) { } 75 41 116
elsif (/\.pod$/) { } 20 21 41
55 75 $dest = \%pm_files
56 } elsif (/\.pod$/) {
57 20 $dest = \%pod_files
58 } else {
59 21 return;
60 }
61 95 my $d = $dest->{$_} = "lib/YATT/$_";
62 95 $self->_yatt_dist_ensure_blib_copied($_, $d);
63 1 }}, "Lite");
64  
65 # scripts/
66 33 ▶ find({no_chdir => 1, wanted => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
67 33 ▶ return $self->prune if /^\.git|^lib$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\.git|^lib$/ 0 33 33
68 33 ▶ return if -d $_;
Branch: 1 branch
BranchTrueFalseTotal
if -d $_ 5 28 33
69 28 ▶ return unless -x $_ and m{/yatt[^/]*$};
Branch: 1 branch
BranchTrueFalseTotal
unless -x $_ and m[/yatt[^/]*$] 12 16 28
Condition100%3/3
-x $_ and m[/yatt[^/]*$]
!ll&&!rl&&r
3916
MC/DC100%2/2
-x $_ and m[/yatt[^/]*$]
-x $_ m[/yatt[^/]*$]
Truth table100%3/3
A and B
A= -x $_B= m[/yatt[^/]*$]
ABresult
0X0
100
111
70 16 my $d = $script_files{$_} = "bin/". File::Basename::basename($_);
71 16 $self->_yatt_dist_ensure_blib_copied($_, $d);
72 1 }}, 'scripts');
73  
74 # elisp/ also should go into blib/lib/YATT/
75 # XXX: This may be changed to blib/lib/YATT/Lite/ or somewhere else.
76 7 ▶ find({no_chdir => 1, wanted => sub {
Subroutine __ANON__: called CC=4 SCAR=14.1
77 7 ▶ return $self->prune if /^\.git|^lib$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\.git|^lib$/ 0 7 7
78 7 ▶ return if -d $_;
Branch: 1 branch
BranchTrueFalseTotal
if -d $_ 1 6 7
79 6 ▶ return unless m{\.el$};
Branch: 1 branch
BranchTrueFalseTotal
unless /\.el$/ 0 6 6
80 6 my $d = $pm_files{$_} = "lib/YATT/$_";
81 6 $self->_yatt_dist_ensure_blib_copied($_, $d);
82 1 }}, 'elisp');
83 }
84  
85 119 ▶sub _yatt_dist_ensure_blib_copied {
Subroutine _yatt_dist_ensure_blib_copied: called CC=2 SCAR=7.4
86 119 my ($self, $from, $dest) = @_;
87 119 my $to = $self->catfile($self->blib, $dest);
88 119 ▶ if ($ENV{DEBUG_BUILD}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'DEBUG_BUILD'}) { } 0 119 119
89 0 print STDERR "$from => $to\n";
90 } else {
91 119 $self->copy_if_modified(from => $from, to => $to);
92 }
93 }
94  
95 0 ▶sub prune {
Subroutine prune: not called CC=1 SCAR=6.9
Pod undocumented
96 0 $File::Find::prune = 1;
97 }
98  
99 #========================================
100 #
101 # To remove leading 'v' from dist_version.
102 #
103  
104 0 ▶sub dist_version {
Subroutine dist_version: not called CC=2 SCAR=17.9
Pod undocumented
105 0 my ($self) = @_;
106 0 ▶ my $ver = $self->SUPER::dist_version
Branch: 1 branch
BranchTrueFalseTotal
my $ver = $self->SUPER::dist_version or die "Can't detect dist_version" 0 0 0
107 or die "Can't detect dist_version";
108 0 $ver =~ s/^v//;
109 0 $ver;
110 }
111  
112 1 1;
113 __END__
« blib/lib/YATT/Lite/Site/Registry.pm ↑ Summary blib/lib/YATT/Lite/XHF/Dumper.pm »