blib/lib/Dist/Zilla/PluginBundle/Author/Plicease.pm

filter: Statementstmt 95.9% 142 / 148 Branchbran 77.7% 56 / 72 Conditioncond 90.6% 29 / 32 MC/DCmcdc 72.2% 13 / 18 Subroutinesub 86.6% 13 / 15 Podpod 0.0% 0 / 2 totaltotal 88.1% 253 / 287 CC 57 SCAR 38.5
CC
57
Cov
90%
configure
60.0
_my_add_plugin
3.0
__ANON__
2.0
CRAP 46.8
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/MakeMaker.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/SpecialPrereqs.pm »
1 3 package Dist::Zilla::PluginBundle::Author::Plicease 2.81 {
2  
3 3 ▶ use 5.022;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶ use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶ use Dist::Zilla;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶ use PerlX::Maybe qw( maybe provided );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶ use Term::ANSIColor ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶ use Dist::Zilla::Util::CurrentCmd ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶ use Path::Tiny qw( path );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶ use File::Glob qw( bsd_glob );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶ use Dist::Zilla::Plugin::Author::Plicease;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # ABSTRACT: Dist::Zilla plugin bundle used by Plicease
14  
15  
16 3 with 'Dist::Zilla::Role::PluginBundle::Easy';
17  
18 1 ▶ sub mvp_multivalue_args { qw(
Subroutine mvp_multivalue_args: called CC=1 SCAR=0.0
Pod undocumented
19 upgrade
20 preamble
21 diag_preamble
22 workflow
23 clean
24 clean_keep
25  
26 diag
27 allow_dirty ) }
28  
29 471 ▶ sub _my_add_plugin {
Subroutine _my_add_plugin: called CC=3 SCAR=11.0
30 471 my($self, @specs) = @_;
31  
32 471 foreach my $spec (map { [@$_] } @specs)
33 {
34 653 my $plugin = $spec->[0];
35 653 ▶ my %args = ref $spec->[-1] ? %{ pop @$spec } : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $spec->[-1] ? : 296 357 653
36 653 $self->add_plugins([@$spec, \%args]);
37 }
38 };
39  
40 sub configure
41 32 ▶ {
Subroutine configure: called CC=55 SCAR=40.9
Pod undocumented
42 32 my($self) = @_;
43  
44 32 ▶ if(my @bad = grep { defined $self->payload->{$_} } qw( travis_status travis_com travis_base travis_image_base appveyor travis_user appveyor_user ))
Branch: 1 branch
BranchTrueFalseTotal
if (my(@bad) = grep({defined $self->payload->{$_};} "travis_status", "travis_com", "travis_base", "travis_image_base", "appveyor", "travis_user", "appveyor_user")) 8 24 32
45 {
46 8 die "dist.ini [\@Author::Plicease] no longer supports: @bad\n";
47 }
48  
49 # undocumented for a reason: sometimes I need to release on
50 # a different platform that where I do testing, (eg. MSWin32
51 # only modules, where Dist::Zilla is frequently not working
52 # right).
53 24 ▶ if($self->payload->{non_native_release})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->payload->{"non_native_release"}) 0 24 24
54 {
55 3 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
56 0 require Dist::Zilla::Role::BuildPL;
57 0 ▶ *Dist::Zilla::Role::BuildPL::build = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *Dist::Zilla::Role::BuildPL::test = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 }
60  
61 24 foreach my $script (qw( before_build.pl before_release.pl release.pl test.pl after_build.pl after_release.pl ))
62 {
63 144 ▶ if(-r "inc/run/$script")
Branch: 1 branch
BranchTrueFalseTotal
if (-r "inc/run/$script") 1 143 144
64 {
65 1 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
66 1 print STDERR "please rename inc/run/$script to maint/run-$script";
67 1 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
68 1 print STDERR "\n";
69 }
70 }
71  
72 24 foreach my $prefix (qw( inc/run/ maint/run- ))
73 {
74 48 ▶ $self->_my_add_plugin(['Run::BeforeBuild' => { run => "%x ${prefix}before_build.pl --name %n --version %v" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}before_build.pl" 3 45 48
75 if -r "${prefix}before_build.pl";
76  
77 48 ▶ $self->_my_add_plugin(['Run::BeforeRelease' => { run => "%x ${prefix}before_release.pl ---name %n --version %v --dir %d --archive %a" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}before_release.pl" 1 47 48
78 if -r "${prefix}before_release.pl";
79  
80 48 ▶ $self->_my_add_plugin(['Run::Release' => { run => "%x ${prefix}release.pl ---name %n --version %v --dir %d --archive %a" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}release.pl" 1 47 48
81 if -r "${prefix}release.pl";
82  
83 48 ▶ $self->_my_add_plugin(['Run::Test' => { run => "%x ${prefix}test.pl ---name %n --version %v --dir %d" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}test.pl" 1 47 48
84 if -r "${prefix}test.pl";
85 }
86  
87 $self->_my_add_plugin(
88 24 ['GatherDir' => { exclude_filename => [qw( Makefile.PL Build.PL xt/release/changes.t xt/release/fixme.t )],
89 exclude_match => '^_build/' }, ],
90 [ 'PruneCruft' ],
91 [ 'ManifestSkip' ],
92 [ 'MetaYAML', ],
93 [ 'License', ],
94 [ 'ExecDir', ],
95 [ 'ShareDir', ],
96 );
97  
98 24 do { # installer stuff
99 24 my $installer = $self->payload->{installer};
100 24 my %mb = map { $_ => $self->payload->{$_} } grep /^mb_/, keys %{ $self->payload };
101 24 ▶ if(-e "inc/My/ModuleBuild.pm")
Branch: 1 branch
BranchTrueFalseTotal
if (-e "inc/My/ModuleBuild.pm") 1 23 24
102 {
103 1 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
104 1 print STDERR "please migrate off of Module::Build";
105 1 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
106 1 print STDERR "\n";
107  
108 1 ▶ $installer ||= 'ModuleBuild';
Condition50%1/2
$installer ||= "ModuleBuild"
l!l
01
MC/DC0%0/1
$installer ||= "ModuleBuild"
$installer
Truth table50%1/2
A
A= $installer
Aresult
11
00
109 $mb{mb_class} = 'My::ModuleBuild'
110 1 ▶ unless defined $mb{mb_class};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mb{"mb_class"} 1 0 1
111 }
112 24 ▶ if(defined $installer && $installer eq 'Alien')
Branch: 2 branches
BranchTrueFalseTotal
if (defined $installer and $installer eq 'Alien') { } 1 23 24
elsif (defined $installer and $installer eq 'ModuleBuild') { } 2 21 23
Condition100%3/3
defined $installer and $installer eq "Alien"
!ll&&!rl&&r
1941
MC/DC100%2/2
defined $installer and $installer eq "Alien"
defined $installer $installer eq "Alien"
Truth table100%3/3
A and B
A= defined $installerB= $installer eq "Alien"
ABresult
0X0
100
111
113 {
114 1 die "[Alien] no longer supported as an installer";
115 }
116 ▶ elsif(defined $installer && $installer eq 'ModuleBuild')
Condition100%3/3
defined $installer and $installer eq "ModuleBuild"
!ll&&!rl&&r
1922
MC/DC100%2/2
defined $installer and $installer eq "ModuleBuild"
defined $installer $installer eq "ModuleBuild"
Truth table100%3/3
A and B
A= defined $installerB= $installer eq "ModuleBuild"
ABresult
0X0
100
111
117 {
118 2 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 2 2
119 2 print STDERR "please migrate off of Module::Build";
120 2 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 2 2
121 2 print STDERR "\n";
122  
123 2 $self->_my_add_plugin([ ModuleBuild => \%mb ]);
124 }
125 else
126 {
127 21 ▶ $installer ||= 'Author::Plicease::MakeMaker';
Condition100%2/2
$installer ||= "Author::Plicease::MakeMaker"
l!l
219
MC/DC100%1/1
$installer ||= "Author::Plicease::MakeMaker"
$installer
Truth table100%2/2
A
A= $installer
Aresult
11
00
128 21 $self->_my_add_plugin([$installer]);
129 }
130 };
131  
132 23 $self->_my_add_plugin(map { [$_] } qw(
133 Manifest
134 TestRelease
135 PodWeaver
136 ));
137  
138 23 $self->_my_add_plugin([ NextRelease => { format => '%-9v %{yyyy-MM-dd HH:mm:ss Z}d' }]);
139  
140 23 $self->_my_add_plugin(['AutoPrereqs']);
141 $self->_my_add_plugin([$self->payload->{version_plugin} || (
142 'OurPkgVersion', {
143 23 ▶ underscore_eval_version => $self->{payload}->{underscore_eval_version} // 1,
Condition80%4/5
$self->payload->{'version_plugin'} || ('OurPkgVersion', {'underscore_eval_version', $self->{'payload'}{'underscore_eval_version'} // 1, 'no_critic', 1})
l!l&&r!l&&!r
2210
$self->{"payload"}{"underscore_eval_version"} // 1
l!l
120
MC/DC0%0/2
$self->payload->{'version_plugin'} || ('OurPkgVersion', {'underscore_eval_version', $self->{'payload'}{'underscore_eval_version'} // 1, 'no_critic', 1})
$self->payload->{'version_plugin'} ('OurPkgVersion', {'underscore_eval_version', $self->{'payload'}{'underscore_eval_version'} // 1, 'no_critic', 1})
MC/DC100%1/1
$self->{"payload"}{"underscore_eval_version"} // 1
$self->{"payload"}{"underscore_eval_version"}
Truth table66%2/3
A || B
A= $self->payload->{'version_plugin'}B= ('OurPkgVersion', {'underscore_eval_version', $self->{'payload'}{'underscore_eval_version'} // 1, 'no_critic', 1})
ABresult
1X1
011
000
Truth table100%2/2
A
A= $self->{"payload"}{"underscore_eval_version"}
Aresult
11
00
144 no_critic => 1,
145 }
146 )]);
147 23 $self->_my_add_plugin(['MetaJSON']);
148  
149 23 ▶ if(Dist::Zilla::Plugin::Author::Plicease->git)
Branch: 1 branch
BranchTrueFalseTotal
if ("Dist::Zilla::Plugin::Author::Plicease"->git) 23 0 23
150 {
151 23 foreach my $plugin (qw( Git::Check Git::Commit Git::Tag Git::Push ))
152 {
153 92 my %args;
154 92 ▶ $args{'allow_dirty'} = [ qw( dist.ini Changes README.md ), @{ $self->payload->{allow_dirty} || [] } ]
Branch: 1 branch
BranchTrueFalseTotal
if $plugin =~ /^Git::(Check|Commit)$/u 46 46 92
Condition100%2/2
$self->payload->{'allow_dirty'} || []
l!l
244
MC/DC100%1/1
$self->payload->{'allow_dirty'} || []
$self->payload->{'allow_dirty'}
Truth table100%2/2
A
A= $self->payload->{'allow_dirty'}
Aresult
11
00
155 if $plugin =~ /^Git::(Check|Commit)$/;
156 92 $self->_my_add_plugin([$plugin, \%args])
157 }
158 }
159  
160 23 do {
161 23 my $name = path(".")->absolute->basename;
162 23 ▶ my $user = $self->payload->{github_user} || 'plicease';
Condition100%2/2
$self->payload->{'github_user'} || 'plicease'
l!l
221
MC/DC100%1/1
$self->payload->{'github_user'} || 'plicease'
$self->payload->{'github_user'}
Truth table100%2/2
A
A= $self->payload->{'github_user'}
Aresult
11
00
163 23 ▶ my $repo = $self->payload->{github_repo} || $name;
Condition66%2/3
$self->payload->{'github_repo'} || $name
l!l&&r!l&&!r
1220
MC/DC0%0/2
$self->payload->{'github_repo'} || $name
$self->payload->{'github_repo'} $name
Truth table66%2/3
A || B
A= $self->payload->{'github_repo'}B= $name
ABresult
1X1
011
000
164  
165 $self->_my_add_plugin([
166 'MetaResources' => {
167 22 ▶ 'homepage' => $self->payload->{homepage} || "https://metacpan.org/pod/@{[ do { my $foo = $name; $foo =~ s/-/::/g; $foo }]}",
Condition100%8/8
$self->payload->{'bugtracker.web'} || sprintf('https://github.com/%s/%s/issues', $user, $repo)
l!l
122
$self->payload->{'repository.url'} || sprintf('https://github.com/%s/%s.git', $user, $repo)
l!l
122
$self->payload->{'repository.web'} || sprintf('https://github.com/%s/%s', $user, $repo)
l!l
122
$self->payload->{'repository.type'} || 'git'
l!l
122
MC/DC100%1/1
$self->payload->{'bugtracker.web'} || sprintf('https://github.com/%s/%s/issues', $user, $repo)
$self->payload->{'bugtracker.web'}
MC/DC100%1/1
$self->payload->{'repository.url'} || sprintf('https://github.com/%s/%s.git', $user, $repo)
$self->payload->{'repository.url'}
MC/DC100%1/1
$self->payload->{'repository.web'} || sprintf('https://github.com/%s/%s', $user, $repo)
$self->payload->{'repository.web'}
MC/DC100%1/1
$self->payload->{'repository.type'} || 'git'
$self->payload->{'repository.type'}
Truth table100%2/2
A
A= $self->payload->{'bugtracker.web'}
Aresult
11
00
Truth table100%2/2
A
A= $self->payload->{'repository.url'}
Aresult
11
00
Truth table100%2/2
A
A= $self->payload->{'repository.web'}
Aresult
11
00
Truth table100%2/2
A
A= $self->payload->{'repository.type'}
Aresult
11
00
168 'bugtracker.web' => $self->payload->{'bugtracker.web'} || sprintf("https://github.com/%s/%s/issues", $user, $repo),
169 'repository.url' => $self->payload->{'repository.url'} || sprintf("https://github.com/%s/%s.git", $user, $repo),
170 'repository.web' => $self->payload->{'repository.web'} || sprintf("https://github.com/%s/%s", $user, $repo),
171 'repository.type' => $self->payload->{'repository.type'} || 'git',
172 maybe 'x_IRC' => $self->payload->{irc},
173 23 ▶ provided $user =~ /\APerlFFI\Z/i, 'x_twitter' => 'https://fosstodon.org/@PerlFFI',
Condition100%2/2
$self->payload->{'homepage'} || "https://metacpan.org/pod/@{[do { my $foo = $name; $foo =~ s/-/::/gu; $foo }];}"
l!l
122
MC/DC100%1/1
$self->payload->{'homepage'} || "https://metacpan.org/pod/@{[do { my $foo = $name; $foo =~ s/-/::/gu; $foo }];}"
$self->payload->{'homepage'}
Truth table100%2/2
A
A= $self->payload->{'homepage'}
Aresult
11
00
174 },
175 ]);
176 };
177  
178 23 ▶ if($self->payload->{release_tests})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->payload->{"release_tests"}) 2 21 23
179 {
180 $self->_my_add_plugin([
181 'Author::Plicease::Tests' => {
182 maybe diag => $self->payload->{diag},
183 maybe diag_preamble => $self->payload->{diag_preamble},
184 maybe test2_v0 => $self->payload->{test2_v0},
185 }
186 2 ]);
187 }
188  
189 23 $self->_my_add_plugin(map { [$_] } qw(
190  
191 InstallGuide
192  
193 ));
194  
195 $self->_my_add_plugin([
196 MinimumPerl => {
197 maybe perl => $self->payload->{perl},
198 },
199 23 ]);
200  
201 $self->_my_add_plugin([
202 'Author::Plicease::SpecialPrereqs' => {
203 maybe upgrade => $self->payload->{upgrade},
204 maybe preamble => $self->payload->{preamble},
205 maybe win32 => $self->payload->{win32},
206 },
207 23 ]);
208  
209 23 $self->_my_add_plugin(map { [$_] } qw(
210  
211 ConfirmRelease
212  
213 ));
214  
215 23 ▶ unless($self->payload->{no_readme})
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->payload->{"no_readme"}) 22 1 23
216 {
217 $self->_my_add_plugin([
218 'Author::Plicease::ReadmeAnyFromPod' => {
219 type => 'text',
220 filename => 'README',
221 location => 'build',
222 maybe source_filename => $self->payload->{readme_from},
223 maybe default_branch => $self->payload->{default_branch},
224 },
225 22 ]);
226  
227 $self->_my_add_plugin([
228 'Author::Plicease::ReadmeAnyFromPod' => ReadMePodInRoot => {
229 type => 'gfm',
230 filename => 'README.md',
231 location => 'root',
232 maybe source_filename => $self->payload->{readme_from},
233 maybe default_branch => $self->payload->{default_branch},
234  
235 # these are for my ReadmeAnyFromPod wrapper.
236 maybe github_user => $self->payload->{github_user},
237 maybe github_repo => $self->payload->{github_repo},
238 maybe workflow => $self->payload->{workflow},
239 },
240 22 ]);
241 }
242  
243 23 ▶ if($self->payload->{copy_mb})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->payload->{"copy_mb"}) 1 22 23
244 {
245 1 $self->_my_add_plugin([
246 'CopyFilesFromBuild' => {
247 copy => [ 'Build.PL' ],
248 },
249 ]);
250 }
251  
252 23 ▶ if($self->payload->{copy_mm})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->payload->{"copy_mm"}) 1 22 23
253 {
254 1 $self->_my_add_plugin([
255 'CopyFilesFromBuild' => {
256 copy => [ 'Makefile.PL' ],
257 },
258 ]);
259 }
260  
261 23 foreach my $test (map { path($_) } bsd_glob ('t/*.t'))
262 {
263 19 my @lines = grep !/-no_srand => 1/, grep /use Test2::V0/, $test->lines_utf8;
264 19 ▶ next unless @lines;
Branch: 1 branch
BranchTrueFalseTotal
unless @lines 18 1 19
265 1 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
266 1 print STDERR "$test has Test2::V0 without -no_srand";
267 1 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
268 1 print STDERR "\n";
269 }
270  
271 23 ▶ if(-f 'Changes')
Branch: 1 branch
BranchTrueFalseTotal
if (-f 'Changes') { } 21 2 23
272 {
273 21 my $text = path('Changes')->slurp_utf8;
274 21 ▶ if($text =~ /\}\}\}/)
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ /\}\}\}/u) 1 20 21
275 {
276 1 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
277 1 print STDERR "Please fix extra } in Changes template";
278 1 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 1 1
279 1 print STDERR "\n";
280 }
281 }
282 else
283 {
284 2 ▶ print STDERR Term::ANSIColor::color('bold red') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 2 2
285 2 print STDERR "no Changes file";
286 2 ▶ print STDERR Term::ANSIColor::color('reset') if -t STDERR;
Branch: 1 branch
BranchTrueFalseTotal
if -t STDERR 0 2 2
287 2 print STDERR "\n";
288 }
289  
290 23 $self->_my_add_plugin(
291 [ 'Author::Plicease::NoUnsafeInc' ],
292 );
293  
294 23 foreach my $prefix (qw( inc/run/ maint/run- ))
295 {
296 46 ▶ $self->_my_add_plugin(['Run::AfterBuild' => { run => "%x ${prefix}after_build.pl --name %n --version %v --dir %d" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}after_build.pl" 1 45 46
297 if -r "${prefix}after_build.pl";
298  
299 46 ▶ $self->_my_add_plugin(['Run::AfterRelease' => { run => "%x ${prefix}after_release.pl --name %n --version %v --dir %d --archive %a" }])
Branch: 1 branch
BranchTrueFalseTotal
if -r "${prefix}after_release.pl" 1 45 46
300 if -r "${prefix}after_release.pl";
301  
302 }
303  
304 0 ▶ if(eval { require Dist::Zilla::Plugin::Libarchive; Dist::Zilla::Plugin::Libarchive->VERSION('0.03'); 1 })
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { require Dist::Zilla::Plugin::Libarchive; 'Dist::Zilla::Plugin::Libarchive'->VERSION('0.03'); 1 } }) { } 0 23 23
305 {
306 0 $self->_my_add_plugin(['Libarchive']);
307 }
308 else
309 {
310 23 $self->_my_add_plugin(['ArchiveTar']);
311 }
312  
313 $self->_my_add_plugin(['Author::Plicease::Cleaner' => {
314 maybe clean => $self->payload->{clean},
315 maybe clean_keep => $self->payload->{clean_keep}
316 23 }]);
317 }
318  
319 3 __PACKAGE__->meta->make_immutable;
320 }
321  
322 3 1;
323  
324 __END__
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/MakeMaker.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/SpecialPrereqs.pm »