File Coverage

blib/lib/Dist/Zilla/Plugin/Manifest.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 7 7 100.0
pod 0 1 0.0
total 36 38 94.7


line stmt bran cond sub pod time code
1             # ABSTRACT: build a MANIFEST file
2              
3             use Moose;
4 13     13   9658 with 'Dist::Zilla::Role::FileGatherer';
  13         34  
  13         124  
5              
6             use Dist::Zilla::Pragmas;
7 13     13   90746  
  13         38  
  13         130  
8             use namespace::autoclean;
9 13     13   115  
  13         34  
  13         142  
10             use Dist::Zilla::File::FromCode;
11 13     13   5234  
  13         50  
  13         5346  
12             #pod =head1 DESCRIPTION
13             #pod
14             #pod If included, this plugin will produce a F<MANIFEST> file for the distribution,
15             #pod listing all of the files it contains. For obvious reasons, it should be
16             #pod included as close to last as possible.
17             #pod
18             #pod This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic>
19             #pod bundle.
20             #pod
21             #pod =head1 SEE ALSO
22             #pod
23             #pod Dist::Zilla core plugins:
24             #pod L<@Basic|Dist::Zilla::PluginBundle::Manifest>,
25             #pod L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>.
26             #pod
27             #pod Other modules: L<ExtUtils::Manifest>.
28             #pod
29             #pod =cut
30              
31             my ($name) = @_;
32             return $name unless $name =~ /[ '\\]/;
33 134     134   200 $name =~ s/\\/\\\\/g;
34 134 100       452 $name =~ s/'/\\'/g;
35 5         15 return qq{'$name'};
36 5         25 }
37 5         16  
38             my ($self, $arg) = @_;
39              
40             my $zilla = $self->zilla;
41 12     12 0 57  
42             my $file = Dist::Zilla::File::FromCode->new({
43 12         366 name => 'MANIFEST',
44             code_return_type => 'bytes',
45             code => sub {
46             my $generated_by = sprintf "%s v%s", ref($self), $self->VERSION || '(dev)';
47              
48             return "# This file was automatically generated by $generated_by.\n"
49 12   50 12   250 . join("\n", map { __fix_filename($_) } sort map { $_->name } @{ $zilla->files })
50             . "\n",
51             },
52 12         87 });
  134         258  
  134         348  
  12         399  
53              
54             $self->add_file($file);
55 12         536 }
56              
57 12         85 __PACKAGE__->meta->make_immutable;
58             1;
59              
60              
61             =pod
62              
63             =encoding UTF-8
64              
65             =head1 NAME
66              
67             Dist::Zilla::Plugin::Manifest - build a MANIFEST file
68              
69             =head1 VERSION
70              
71             version 6.028
72              
73             =head1 DESCRIPTION
74              
75             If included, this plugin will produce a F<MANIFEST> file for the distribution,
76             listing all of the files it contains. For obvious reasons, it should be
77             included as close to last as possible.
78              
79             This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic>
80             bundle.
81              
82             =head1 PERL VERSION
83              
84             This module should work on any version of perl still receiving updates from
85             the Perl 5 Porters. This means it should work on any version of perl released
86             in the last two to three years. (That is, if the most recently released
87             version is v5.40, then this module should work on both v5.40 and v5.38.)
88              
89             Although it may work on older versions of perl, no guarantee is made that the
90             minimum required version will not be increased. The version may be increased
91             for any reason, and there is no promise that patches will be accepted to lower
92             the minimum required perl.
93              
94             =head1 SEE ALSO
95              
96             Dist::Zilla core plugins:
97             L<@Basic|Dist::Zilla::PluginBundle::Manifest>,
98             L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>.
99              
100             Other modules: L<ExtUtils::Manifest>.
101              
102             =head1 AUTHOR
103              
104             Ricardo SIGNES 😏 <cpan@semiotic.systems>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2022 by Ricardo SIGNES.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut