blib/lib/Dist/Zilla/Plugin/Manifest.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 92.8% 39 / 42 CC 3 SCAR 3.7
CC
3
Cov
97%
__ANON__
2.0
__fix_filename
2.0
gather_files
1.0
CRAP 1.4
« blib/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/ExtraTests.pm »
1 package Dist::Zilla::Plugin::Manifest 6.040;
2 # ABSTRACT: build a MANIFEST file
3  
4 13 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 with 'Dist::Zilla::Role::FileGatherer';
6  
7 13 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 13 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 ▶use Dist::Zilla::File::FromCode;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 #pod =head1 DESCRIPTION
14 #pod
15 #pod If included, this plugin will produce a F<MANIFEST> file for the distribution,
16 #pod listing all of the files it contains. For obvious reasons, it should be
17 #pod included as close to last as possible.
18 #pod
19 #pod This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic>
20 #pod bundle.
21 #pod
22 #pod =head1 SEE ALSO
23 #pod
24 #pod Dist::Zilla core plugins:
25 #pod L<@Basic|Dist::Zilla::PluginBundle::Manifest>,
26 #pod L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>.
27 #pod
28 #pod Other modules: L<ExtUtils::Manifest>.
29 #pod
30 #pod =cut
31  
32 134 ▶sub __fix_filename {
Subroutine __fix_filename: called CC=2 SCAR=6.9
33 134 my ($name) = @_;
34 134 ▶ return $name unless $name =~ /[ '\\]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /[ '\\]/u 129 5 134
35 5 $name =~ s/\\/\\\\/g;
36 5 $name =~ s/'/\\'/g;
37 5 return qq{'$name'};
38 }
39  
40 12 ▶sub gather_files {
Subroutine gather_files: called CC=1 SCAR=0.0
Pod undocumented
41 12 my ($self, $arg) = @_;
42  
43 12 my $zilla = $self->zilla;
44  
45 my $file = Dist::Zilla::File::FromCode->new({
46 name => 'MANIFEST',
47 code_return_type => 'bytes',
48 12 ▶ code => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
49 12 ▶ my $generated_by = sprintf "%s v%s", ref($self), $self->VERSION || '(dev)';
Condition50%1/2
$self->VERSION || '(dev)'
l!l
120
MC/DC0%0/1
$self->VERSION || '(dev)'
$self->VERSION
Truth table50%1/2
A
A= $self->VERSION
Aresult
11
00
50  
51 return "# This file was automatically generated by $generated_by\n"
52 12 . join("\n", map { __fix_filename($_) } sort map { $_->name } @{ $zilla->files })
53 . "\n",
54 },
55 12 });
56  
57 12 $self->add_file($file);
58 }
59  
60 13 __PACKAGE__->meta->make_immutable;
61 13 1;
62  
63 __END__
« blib/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/ExtraTests.pm »