line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::ManifestInRoot; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1833086
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
52
|
use version; our $VERSION = qv( sprintf '0.14.%d', q$Rev: 1 $ =~ /\d+/gmx ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
81
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
4342
|
use Dist::Zilla::File::FromCode; |
|
1
|
|
|
|
|
44377
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
4
|
use Path::Tiny qw( path ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
414
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::AfterBuild'; |
11
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::BeforeBuild'; |
12
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileGatherer'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Public attributes |
15
|
|
|
|
|
|
|
has 'excludes' => is => 'ro', traits => [ 'Array' ], |
16
|
|
|
|
|
|
|
default => sub { [ qw( LICENSE META.json META.yml README SIGNATURE |
17
|
|
|
|
|
|
|
t/00report-metadata.dd t/00report-metadata.t ) ]}, |
18
|
|
|
|
|
|
|
handles => { 'excluding' => 'elements', }, init_arg => 'exclude'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Private functions |
21
|
|
|
|
|
|
|
my $_fix_filename = sub { |
22
|
|
|
|
|
|
|
my $name = shift; $name =~ m{ [ \'\\] }mx or return $name; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$name =~ s{ \\ }{\\\\}gmx; $name =~ s{ ' }{\\'}gmx; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return qq{'$name'}; |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Public methods |
30
|
|
|
|
|
|
|
sub after_build { |
31
|
0
|
|
|
0
|
1
|
0
|
my ($self, $args) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
my $excluding = join '|', $self->excluding; |
34
|
0
|
|
|
|
|
0
|
my $from = path( $args->{build_root}, 'MANIFEST' ); |
35
|
0
|
|
|
|
|
0
|
my @lines = grep { not m{ \A (?: $excluding ) \r?\n \z }mx } |
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
$from->lines; |
37
|
0
|
|
|
|
|
0
|
my $to = path( $self->zilla->root, 'MANIFEST' ); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
$to->spew( @lines ); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub before_build { |
45
|
1
|
|
|
1
|
1
|
36940
|
my $self = shift; unlink $self->zilla->root->file( 'MANIFEST' ); return; |
|
1
|
|
|
|
|
26
|
|
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub gather_files { |
49
|
0
|
|
|
0
|
1
|
0
|
my ($self, $arg) = @_; my $zilla = $self->zilla; |
|
0
|
|
|
|
|
0
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $file = Dist::Zilla::File::FromCode->new( { |
52
|
|
|
|
|
|
|
name => 'MANIFEST', |
53
|
|
|
|
|
|
|
code => sub { |
54
|
0
|
|
|
|
|
0
|
(join "\n", map { $_fix_filename->( $_ ) } |
55
|
0
|
|
|
0
|
|
0
|
sort map { $_->name } @{ $zilla->files } )."\n"; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
56
|
|
|
|
|
|
|
}, |
57
|
0
|
|
|
|
|
0
|
} ); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
$self->add_file( $file ); |
60
|
0
|
|
|
|
|
0
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub mvp_multivalue_args { |
64
|
1
|
|
|
1
|
1
|
151
|
return qw( exclude ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=encoding utf-8 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=begin html |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
<a href="https://travis-ci.org/pjfl/p5-dist-zilla-plugin-manifestinroot"><img src="https://travis-ci.org/pjfl/p5-dist-zilla-plugin-manifestinroot.svg?branch=master" alt="Travis CI Badge"></a> |
78
|
|
|
|
|
|
|
<a href="http://badge.fury.io/pl/Dist-Zilla-Plugin-ManifestInRoot"><img src="https://badge.fury.io/pl/Dist-Zilla-Plugin-ManifestInRoot.svg" alt="CPAN Badge"></a> |
79
|
|
|
|
|
|
|
<a href="http://cpants.cpanauthors.org/dist/Dist-Zilla-Plugin-ManifestInRoot"><img src="http://cpants.cpanauthors.org/dist/Dist-Zilla-Plugin-ManifestInRoot.png" alt="Kwalitee Badge"></a> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=end html |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 Name |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ManifestInRoot - Puts the MANIFEST file in the project root |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 Synopsis |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# In your dist.ini |
90
|
|
|
|
|
|
|
[ManifestInRoot] |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 Version |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This documents version v0.14.$Rev: 1 $ of L<Dist::Zilla::Plugin::ManifestInRoot> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 Description |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Puts the F<MANIFEST> file in the project root so that it can be used by |
99
|
|
|
|
|
|
|
other programs, e.g. L<App::Cpanminus> and L<Module::Provision> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 Configuration and Environment |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Defined these attributes; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 3 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item C<excludes> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
An array reference of file names to exclude from the root directory copy of the |
110
|
|
|
|
|
|
|
manifest. Set using the multivalued initialisation argument C<exclude>. |
111
|
|
|
|
|
|
|
Defaults to the list of files generated by the build process |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 Subroutines/Methods |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 after_build |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Copy the F<MANIFEST> file from the build directory to the project root filtering |
120
|
|
|
|
|
|
|
out unwanted files |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 before_build |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Delete the existing F<MANIFEST> file |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 gather_files |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Create the content providing callback |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 C<mvp_multivalue_args> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns a list of configuration attribute names that are treated as |
133
|
|
|
|
|
|
|
multi valued |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 Diagnostics |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
None |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 Dependencies |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over 3 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item L<Dist::Zilla::Role::InstallTool> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item L<File::Slurp> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item L<Moose> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 Incompatibilities |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
There are no known incompatibilities in this module |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 Bugs and Limitations |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
There are no known bugs in this module. Please report problems to |
158
|
|
|
|
|
|
|
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-Zilla-Plugin-ManifestInRoot. |
159
|
|
|
|
|
|
|
Patches are welcome |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 Acknowledgements |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Larry Wall - For the Perl programming language |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 Author |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Peter Flanigan, C<< <pjfl@cpan.org> >> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 License and Copyright |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Copyright (c) 2015 Peter Flanigan. All rights reserved |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
174
|
|
|
|
|
|
|
under the same terms as Perl itself. See L<perlartistic> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
177
|
|
|
|
|
|
|
but WITHOUT WARRANTY; without even the implied warranty of |
178
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Local Variables: |
183
|
|
|
|
|
|
|
# mode: perl |
184
|
|
|
|
|
|
|
# tab-width: 3 |
185
|
|
|
|
|
|
|
# End: |