line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PruneFiles 6.029; |
2
|
|
|
|
|
|
|
# ABSTRACT: prune arbitrary files from the dist |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2018
|
use Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FilePruner'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
14205
|
use Dist::Zilla::Pragmas; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
15
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
18
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
20
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This plugin allows you to explicitly prune some files from your |
14
|
|
|
|
|
|
|
#pod distribution. You can either specify the exact set of files (with the |
15
|
|
|
|
|
|
|
#pod "filenames" parameter) or provide the regular expressions to |
16
|
|
|
|
|
|
|
#pod check (using "match"). |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod This is useful if another plugin (maybe a FileGatherer) adds a |
19
|
|
|
|
|
|
|
#pod bunch of files, and you only want a subset of them. |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod In your F<dist.ini>: |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod [PruneFiles] |
24
|
|
|
|
|
|
|
#pod filename = xt/release/pod-coverage.t ; pod coverage tests are for jerks |
25
|
|
|
|
|
|
|
#pod filename = todo-list.txt ; keep our secret plans to ourselves |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod match = ^test_data/ |
28
|
|
|
|
|
|
|
#pod match = ^test.cvs$ |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod =cut |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
3
|
0
|
764
|
sub mvp_multivalue_args { qw(filenames matches) } |
33
|
3
|
|
|
3
|
0
|
458
|
sub mvp_aliases { return { filename => 'filenames', match => 'matches' } } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#pod =attr filenames |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod This is an arrayref of filenames to be pruned from the distribution. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has filenames => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
isa => 'ArrayRef', |
44
|
|
|
|
|
|
|
default => sub { [] }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#pod =attr matches |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod This is an arrayref of regular expressions and files matching any of them, |
50
|
|
|
|
|
|
|
#pod will be pruned from the distribution. |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod =cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has matches => ( |
55
|
|
|
|
|
|
|
is => 'ro', |
56
|
|
|
|
|
|
|
isa => 'ArrayRef', |
57
|
|
|
|
|
|
|
default => sub { [] }, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub prune_files { |
61
|
3
|
|
|
3
|
0
|
11
|
my ($self) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# never match (at least the filename characters) |
64
|
3
|
|
|
|
|
14
|
my $matches_regex = qr/\000/; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
9
|
$matches_regex = qr/$matches_regex|$_/ for (@{ $self->matches }); |
|
3
|
|
|
|
|
106
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# \A\Q$_\E should also handle the `eq` check |
69
|
3
|
|
|
|
|
7
|
$matches_regex = qr/$matches_regex|\A\Q$_\E/ for (@{ $self->filenames }); |
|
3
|
|
|
|
|
99
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Copy list (break reference) so we can mutate. |
72
|
3
|
|
|
|
|
9
|
for my $file ((), @{ $self->zilla->files }) { |
|
3
|
|
|
|
|
95
|
|
73
|
9
|
100
|
|
|
|
28
|
next unless $file->name =~ $matches_regex; |
74
|
|
|
|
|
|
|
|
75
|
4
|
|
|
|
|
15
|
$self->log_debug([ 'pruning %s', $file->name ]); |
76
|
|
|
|
|
|
|
|
77
|
4
|
|
|
|
|
217
|
$self->zilla->prune_file($file); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
3
|
|
|
|
|
15
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
87
|
|
|
|
|
|
|
#pod |
88
|
|
|
|
|
|
|
#pod Dist::Zilla plugins: |
89
|
|
|
|
|
|
|
#pod L<PruneCruft|Dist::Zilla::Plugin::PruneCruft>, |
90
|
|
|
|
|
|
|
#pod L<GatherDir|Dist::Zilla::Plugin::GatherDir>, |
91
|
|
|
|
|
|
|
#pod L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>. |
92
|
|
|
|
|
|
|
#pod |
93
|
|
|
|
|
|
|
#pod =cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding UTF-8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PruneFiles - prune arbitrary files from the dist |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 VERSION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
version 6.029 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This plugin allows you to explicitly prune some files from your |
112
|
|
|
|
|
|
|
distribution. You can either specify the exact set of files (with the |
113
|
|
|
|
|
|
|
"filenames" parameter) or provide the regular expressions to |
114
|
|
|
|
|
|
|
check (using "match"). |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is useful if another plugin (maybe a FileGatherer) adds a |
117
|
|
|
|
|
|
|
bunch of files, and you only want a subset of them. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
In your F<dist.ini>: |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
[PruneFiles] |
122
|
|
|
|
|
|
|
filename = xt/release/pod-coverage.t ; pod coverage tests are for jerks |
123
|
|
|
|
|
|
|
filename = todo-list.txt ; keep our secret plans to ourselves |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
match = ^test_data/ |
126
|
|
|
|
|
|
|
match = ^test.cvs$ |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 PERL VERSION |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
131
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
132
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
133
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
136
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
137
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
138
|
|
|
|
|
|
|
the minimum required perl. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 filenames |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is an arrayref of filenames to be pruned from the distribution. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 matches |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This is an arrayref of regular expressions and files matching any of them, |
149
|
|
|
|
|
|
|
will be pruned from the distribution. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 SEE ALSO |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Dist::Zilla plugins: |
154
|
|
|
|
|
|
|
L<PruneCruft|Dist::Zilla::Plugin::PruneCruft>, |
155
|
|
|
|
|
|
|
L<GatherDir|Dist::Zilla::Plugin::GatherDir>, |
156
|
|
|
|
|
|
|
L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
167
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |