line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PruneCruft 6.030; |
2
|
|
|
|
|
|
|
# ABSTRACT: prune stuff that you probably don't mean to include |
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
8196
|
use Moose; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
92
|
|
5
|
10
|
|
|
10
|
|
74456
|
use Moose::Util::TypeConstraints; |
|
10
|
|
|
|
|
30
|
|
|
10
|
|
|
|
|
137
|
|
6
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FilePruner'; |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
23401
|
use Dist::Zilla::Pragmas; |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
103
|
|
9
|
|
|
|
|
|
|
|
10
|
10
|
|
|
10
|
|
87
|
use namespace::autoclean; |
|
10
|
|
|
|
|
59
|
|
|
10
|
|
|
|
|
126
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod This plugin tries to compensate for the stupid crap that turns up in your |
15
|
|
|
|
|
|
|
#pod working copy, removing it before it gets into your dist and screws everything |
16
|
|
|
|
|
|
|
#pod up. |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod In your F<dist.ini>: |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod [PruneCruft] |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod If you would like to exclude certain exclusions, use the C<except> option (it |
23
|
|
|
|
|
|
|
#pod can be specified multiple times): |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod [PruneCruft] |
26
|
|
|
|
|
|
|
#pod except = \.gitignore |
27
|
|
|
|
|
|
|
#pod except = t/.*/\.keep$ |
28
|
|
|
|
|
|
|
#pod |
29
|
|
|
|
|
|
|
#pod This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic> |
30
|
|
|
|
|
|
|
#pod bundle. |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod Dist::Zilla plugins: |
35
|
|
|
|
|
|
|
#pod L<@Basic|Dist::Zilla::PluginBundle::Basic>, |
36
|
|
|
|
|
|
|
#pod L<PruneFiles|Dist::Zilla::Plugin::PruneFiles>, |
37
|
|
|
|
|
|
|
#pod L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
my $type = subtype as 'ArrayRef[RegexpRef]'; |
43
|
|
|
|
|
|
|
coerce $type, from 'ArrayRef[Str]', via { [map { qr/$_/ } @$_] }; |
44
|
|
|
|
|
|
|
has except => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => $type, |
47
|
|
|
|
|
|
|
coerce => 1, |
48
|
|
|
|
|
|
|
default => sub { [] }, |
49
|
|
|
|
|
|
|
); |
50
|
13
|
|
|
13
|
0
|
4158
|
sub mvp_multivalue_args { qw(except) } |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _dont_exclude_file { |
54
|
102
|
|
|
102
|
|
190
|
my ($self, $file) = @_; |
55
|
102
|
|
|
|
|
156
|
for my $exception (@{ $self->except }) { |
|
102
|
|
|
|
|
2959
|
|
56
|
4
|
100
|
|
|
|
13
|
return 1 if $file->name =~ $exception; |
57
|
|
|
|
|
|
|
} |
58
|
101
|
|
|
|
|
247
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub exclude_file { |
62
|
102
|
|
|
102
|
0
|
790
|
my ($self, $file) = @_; |
63
|
|
|
|
|
|
|
|
64
|
102
|
100
|
|
|
|
275
|
return 0 if $self->_dont_exclude_file($file); |
65
|
101
|
100
|
|
|
|
278
|
return 1 if index($file->name, $self->zilla->name . '-') == 0; |
66
|
98
|
50
|
|
|
|
668
|
return 1 if $file->name =~ /\A\./; |
67
|
98
|
100
|
|
|
|
373
|
return 1 if $file->name =~ /\A(?:Build|Makefile)\z/; |
68
|
96
|
50
|
|
|
|
261
|
return 1 if $file->name eq 'Makefile.old'; |
69
|
96
|
50
|
|
|
|
255
|
return 1 if $file->name =~ /\Ablib/; |
70
|
96
|
50
|
|
|
|
263
|
return 1 if $file->name =~ /\.(?:o|bs)$/; |
71
|
96
|
100
|
|
|
|
259
|
return 1 if $file->name =~ /\A_Inline/; |
72
|
95
|
50
|
|
|
|
249
|
return 1 if $file->name eq 'MYMETA.yml'; |
73
|
95
|
50
|
|
|
|
242
|
return 1 if $file->name eq 'MYMETA.json'; |
74
|
95
|
50
|
|
|
|
248
|
return 1 if $file->name eq 'pm_to_blib'; |
75
|
95
|
50
|
|
|
|
252
|
return 1 if substr($file->name, 0, 6) eq '_eumm/'; |
76
|
|
|
|
|
|
|
# Avoid bundling fatlib/ dir created by App::FatPacker |
77
|
|
|
|
|
|
|
# https://github.com/andk/pause/pull/65 |
78
|
95
|
50
|
|
|
|
257
|
return 1 if substr($file->name, 0, 7) eq 'fatlib/'; |
79
|
95
|
50
|
|
|
|
245
|
return 1 if substr($file->name, 0, 4) eq 'tmp/'; |
80
|
|
|
|
|
|
|
|
81
|
95
|
50
|
|
|
|
261
|
if (my $file = $file->name =~ s/\.c$//r) { |
82
|
95
|
|
|
|
|
159
|
for my $other (@{ $self->zilla->files }) { |
|
95
|
|
|
|
|
2559
|
|
83
|
905
|
50
|
|
|
|
2189
|
return 1 if $other->name eq "${file}.xs"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
95
|
|
|
|
|
318
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub prune_files { |
91
|
12
|
|
|
12
|
0
|
38
|
my ($self) = @_; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# Copy list (break reference) so we can mutate. |
94
|
12
|
|
|
|
|
32
|
for my $file ((), @{ $self->zilla->files }) { |
|
12
|
|
|
|
|
430
|
|
95
|
102
|
100
|
|
|
|
272
|
next unless $self->exclude_file($file); |
96
|
|
|
|
|
|
|
|
97
|
6
|
|
|
|
|
24
|
$self->log_debug([ 'pruning %s', $file->name ]); |
98
|
|
|
|
|
|
|
|
99
|
6
|
|
|
|
|
307
|
$self->zilla->prune_file($file); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
12
|
|
|
|
|
109
|
return; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=pod |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=encoding UTF-8 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PruneCruft - prune stuff that you probably don't mean to include |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 VERSION |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
version 6.030 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SYNOPSIS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This plugin tries to compensate for the stupid crap that turns up in your |
125
|
|
|
|
|
|
|
working copy, removing it before it gets into your dist and screws everything |
126
|
|
|
|
|
|
|
up. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
In your F<dist.ini>: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
[PruneCruft] |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
If you would like to exclude certain exclusions, use the C<except> option (it |
133
|
|
|
|
|
|
|
can be specified multiple times): |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
[PruneCruft] |
136
|
|
|
|
|
|
|
except = \.gitignore |
137
|
|
|
|
|
|
|
except = t/.*/\.keep$ |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic> |
140
|
|
|
|
|
|
|
bundle. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 PERL VERSION |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
145
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
146
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
147
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
150
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
151
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
152
|
|
|
|
|
|
|
the minimum required perl. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 SEE ALSO |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Dist::Zilla plugins: |
157
|
|
|
|
|
|
|
L<@Basic|Dist::Zilla::PluginBundle::Basic>, |
158
|
|
|
|
|
|
|
L<PruneFiles|Dist::Zilla::Plugin::PruneFiles>, |
159
|
|
|
|
|
|
|
L<ManifestSkip|Dist::Zilla::Plugin::ManifestSkip>. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This software is copyright (c) 2023 by Ricardo SIGNES. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
170
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |