line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
103952
|
use 5.14.0; |
|
1
|
|
|
|
|
15
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::CheckForUnwantedFiles; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Check for unwanted files |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.0100'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
573
|
use Moose; |
|
1
|
|
|
|
|
489365
|
|
|
1
|
|
|
|
|
7
|
|
12
|
1
|
|
|
1
|
|
8585
|
use namespace::autoclean; |
|
1
|
|
|
|
|
8947
|
|
|
1
|
|
|
|
|
4
|
|
13
|
1
|
|
|
1
|
|
932
|
use Path::Tiny; |
|
1
|
|
|
|
|
11952
|
|
|
1
|
|
|
|
|
60
|
|
14
|
1
|
|
|
1
|
|
676
|
use Types::Standard qw/ArrayRef/; |
|
1
|
|
|
|
|
79080
|
|
|
1
|
|
|
|
|
13
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with qw/ |
17
|
|
|
|
|
|
|
Dist::Zilla::Role::AfterBuild |
18
|
|
|
|
|
|
|
/; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has unwanted_file => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => ArrayRef, |
23
|
|
|
|
|
|
|
default => sub { [] }, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
4
|
0
|
2751065
|
sub mvp_multivalue_args { qw/unwanted_file/ } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub after_build { |
29
|
4
|
|
|
4
|
0
|
391188
|
my $self = shift; |
30
|
4
|
|
|
|
|
18
|
my $root_path = path('.'); |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
135
|
my @existing_unwanted_paths = (); |
33
|
4
|
|
|
|
|
26
|
for my $unwanted (@{ $self->unwanted_file }) { |
|
4
|
|
|
|
|
187
|
|
34
|
3
|
50
|
|
|
|
29
|
push @existing_unwanted_paths => $unwanted if $root_path->child($unwanted)->exists; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
4
|
100
|
|
|
|
224
|
if (scalar @existing_unwanted_paths) { |
38
|
3
|
|
|
|
|
27
|
$self->log('The following unwanted files exist:'); |
39
|
3
|
|
|
|
|
932
|
for my $unwanted (@existing_unwanted_paths) { |
40
|
3
|
|
|
|
|
18
|
$self->log("* $unwanted"); |
41
|
|
|
|
|
|
|
} |
42
|
3
|
|
|
|
|
832
|
$self->log_fatal('Build aborted.'); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Dist::Zilla::Plugin::CheckForUnwantedFiles - Check for unwanted files |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=begin html |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
<p> |
65
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/perl-5.14+-blue.svg" alt="Requires Perl 5.14+" /> |
66
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/coverage-93.6%25-yellow.svg" alt="coverage 93.6%" /> |
67
|
|
|
|
|
|
|
<a href="https://github.com/Csson/p5-Dist-Zilla-Plugin-CheckForUnwantedFiles/actions?query=workflow%3Amakefile-test"><img src="https://img.shields.io/github/workflow/status/Csson/p5-Dist-Zilla-Plugin-CheckForUnwantedFiles/makefile-test" alt="Build status at Github" /></a> |
68
|
|
|
|
|
|
|
</p> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=end html |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Version 0.0100, released 2020-12-29. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
In C<dist.ini> (though it is more useful in a C<PluginBundle>): |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
[CheckForUnwantedFiles] |
81
|
|
|
|
|
|
|
unwanted_file = .travis.yml |
82
|
|
|
|
|
|
|
unwanted_file = .github/ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This plugin checks the development directory (not the build directory) for unwanted files. This is useful when, for instance, switching CI providers, and you don't |
87
|
|
|
|
|
|
|
want to have the previous provider's configuration files lingering around B<and> you are too forgetful to remember to check for them |
88
|
|
|
|
|
|
|
when doing a new release after the switch. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
It is run at the C<AfterBuild> stage, and takes one (repeatable) argument: C<unwanted_file>. It is a fatal error if any unwanted file is found. |
91
|
|
|
|
|
|
|
And, despite its name, it works just as well with unwanted directories. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
So: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item 1 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Remove the plugin that generates the file from the bundle |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item 2 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Add this plugin to the bundle |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item 3 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Add the path to the file gets generated as an C<unwanted_file> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item 4 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
You must delete the unwanted file before the distribution can be built |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SOURCE |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Dist-Zilla-Plugin-CheckForUnwantedFiles> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 HOMEPAGE |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<https://metacpan.org/release/Dist-Zilla-Plugin-CheckForUnwantedFiles> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Erik Carlsson. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
132
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |