Midgen/Role/Output/Dist.pm

filter: Statementstmt 26.4% 23 / 87 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 66.6% 6 / 9 Podpod 100% 3 / 3 totaltotal 21.9% 32 / 146 CC 24 SCAR 47.7
CC
24
Cov
18%
body_dist
210.0
footer_dist
90.0
header_dist
12.0
CRAP 118.5
« Midgen/Role/Experimental.pm ↑ Summary Midgen/Role/Eval.pm »
1 package App::Midgen::Role::Output::Dist;
2  
3 2 ▶use constant {NONE => q{},};
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 requires qw( no_index verbose );
7  
8 # Load time and dependencies negate execution time
9 # use namespace::clean -except => 'meta';
10  
11 2 our $VERSION = '0.34';
12 2 $VERSION = eval $VERSION; ## no critic
13  
14 2 ▶use English qw( -no_match_vars ); # Avoids reg-ex performance penalty
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 local $OUTPUT_AUTOFLUSH = 1;
16  
17 2 ▶use Term::ANSIColor qw( :constants colored );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 #######
21 # header_dist
22 #######
23 0 ▶sub header_dist {
Subroutine header_dist: not called CC=3 SCAR=24.8
Pod documented
24 0 my $self = shift;
25 0 ▶ my $package_name = shift || NONE;
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
26  
27 0 ▶ if ($package_name ne NONE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package_name ne "") 0 0 0
28 0 $package_name =~ s{::}{-}g;
29 0 print "\nname = $package_name\n";
30 0 $package_name =~ tr{-}{/};
31 0 print "main_module = lib/$package_name.pm\n";
32 }
33  
34 0 return;
35 }
36  
37 #######
38 # body_dist
39 #######
40 0 ▶sub body_dist {
Subroutine body_dist: not called CC=14 SCAR=53.5
Pod documented
41 0 my $self = shift;
42 0 ▶ my $title = shift || return;
Condition0%0/2
shift() || (return)
l!l
00
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
43 0 ▶ my $required_ref = shift || return;
Condition0%0/2
shift() || (return)
l!l
00
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
44  
45 0 ▶ return if not %{$required_ref};
Branch: 1 branch
BranchTrueFalseTotal
unless %{$required_ref;} 0 0 0
46  
47 0 print "\n";
48  
49 0 my $pm_length = 0;
50 0 foreach my $module_name (sort keys %{$required_ref}) {
51 0 ▶ if (length $module_name > $pm_length) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $module_name > $pm_length) 0 0 0
52 0 $pm_length = length $module_name;
53 }
54 }
55  
56 0 ▶ if ($title eq 'RuntimeRequires') {
Branch: 5 branches
BranchTrueFalseTotal
if ($title eq 'RuntimeRequires') { } 0 0 0
elsif ($title eq 'RuntimeRecommends') { } 0 0 0
elsif ($title eq 'TestRequires') { } 0 0 0
elsif ($title eq 'TestSuggests') { } 0 0 0
elsif ($title eq 'DevelopRequires') { } 0 0 0
57 0 print "[Prereqs]\n";
58 0 printf "%-*s = %s\n", $pm_length, 'perl', $App::Midgen::Min_Version;
59 }
60 elsif ($title eq 'RuntimeRecommends') {
61 0 print "[Prereqs / RuntimeRecommends]\n";
62 }
63 elsif ($title eq 'TestRequires') {
64 0 print "[Prereqs / TestRequires]\n";
65 }
66 elsif ($title eq 'TestSuggests') {
67 0 print "[Prereqs / TestSuggests]\n";
68 }
69 elsif ($title eq 'DevelopRequires') {
70 0 print "[Prereqs / DevelopRequires]\n";
71 }
72  
73 0 foreach my $module_name (sort keys %{$required_ref}) {
74  
75 next
76 if $title eq 'TestRequires'
77 0 ▶ && $required_ref->{$module_name} =~ m/mcpan/;
Branch: 1 branch
BranchTrueFalseTotal
if $title eq "TestRequires" and $required_ref->{$module_name} =~ /mcpan/ 0 0 0
Condition0%0/3
$title eq "TestRequires" and $required_ref->{$module_name} =~ /mcpan/
!ll&&!rl&&r
000
MC/DC0%0/2
$title eq "TestRequires" and $required_ref->{$module_name} =~ /mcpan/
$title eq "TestRequires" $required_ref->{$module_name} =~ /mcpan/
Truth table0%0/3
A and B
A= $title eq "TestRequires"B= $required_ref->{$module_name} =~ /mcpan/
ABresult
0X0
100
111
78  
79 printf "%-*s = %s\n", $pm_length, $module_name,
80 0 $required_ref->{$module_name};
81 }
82  
83 0 return;
84 }
85  
86 #######
87 # footer_dist
88 #######
89 0 ▶sub footer_dist {
Subroutine footer_dist: not called CC=9 SCAR=45.0
Pod documented
90 0 my $self = shift;
91 0 ▶ my $package_name = shift || NONE;
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
92 0 $package_name =~ s{::}{-}g;
93  
94 0 print "\n";
95 0 my @no_index = $self->no_index;
96 0 ▶ if (@no_index) {
Branch: 1 branch
BranchTrueFalseTotal
if (@no_index) 0 0 0
97 0 print "[MetaNoIndex]\n";
98 0 foreach (@no_index) {
99 0 ▶ print "directory = $_\n" if $_ ne 'inc';
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne "inc" 0 0 0
100 }
101 0 print "\n";
102 }
103  
104 0 ▶ if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'share')) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined -d "File::Spec"->catdir($App::Midgen::Working_Dir, "share")) 0 0 0
105 0 print "[ShareDir]\n";
106 0 print "dir = share\n\n";
107 }
108  
109 0 ▶ if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'script')) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined -d 'File::Spec'->catdir($App::Midgen::Working_Dir, 'script')) { } 0 0 0
elsif (defined -d 'File::Spec'->catdir($App::Midgen::Working_Dir, 'bin')) { } 0 0 0
110 0 print "[ExecDir]\n";
111 0 print "dir = script\n\n";
112 }
113 elsif (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'bin')) {
114 0 print "[ExecDir]\n";
115 0 print "dir = bin\n\n";
116 }
117  
118 0 ▶ if ($self->verbose > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose > 0) 0 0 0
119 0 print BRIGHT_BLACK;
120 0 print "[MetaResources]\n";
121 0 print "homepage = https://github.com/.../$package_name\n";
122 0 print "bugtracker.web = https://github.com/.../$package_name/issues\n";
123 0 print "bugtracker.mailto = ...\n";
124 0 print "repository.url = git://github.com/.../$package_name.git\n";
125 0 print "repository.type = git\n";
126 0 print "repository.web = https://github.com/.../$package_name";
127 0 print "\n";
128  
129 0 print "[Meta::Contributors]\n";
130 0 print "contributor = brian d foy (ADOPTME) <brian.d.foy\@gmail.com>\n";
131 0 print "contributor = Fred Bloggs <fred\@bloggs.org>\n";
132 0 print CLEAR "\n";
133 }
134  
135 0 return;
136 }
137  
138  
139 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
140  
141 2 1;
142  
143 __END__
« Midgen/Role/Experimental.pm ↑ Summary Midgen/Role/Eval.pm »