line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
5829859
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
108
|
|
2
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
934
|
|
3
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Test::EOL; # git description: 0.18-26-gf608025 |
4
|
|
|
|
|
|
|
# vim: set ts=8 sts=4 sw=4 tw=115 et : |
5
|
|
|
|
|
|
|
# ABSTRACT: Author tests making sure correct line endings are used |
6
|
|
|
|
|
|
|
# KEYWORDS: plugin test testing author development whitespace newline linefeed formatting |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.19'; |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
465
|
use Moose; |
|
4
|
|
|
|
|
322117
|
|
|
4
|
|
|
|
|
28
|
|
11
|
4
|
|
|
4
|
|
18142
|
use Path::Tiny; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
212
|
|
12
|
4
|
|
|
4
|
|
623
|
use Sub::Exporter::ForMethods 'method_installer'; |
|
4
|
|
|
|
|
709
|
|
|
4
|
|
|
|
|
44
|
|
13
|
|
|
|
|
|
|
use Data::Section 0.004 # fixed header_re |
14
|
4
|
|
|
4
|
|
1070
|
{ installer => method_installer }, '-setup'; |
|
4
|
|
|
|
|
8828
|
|
|
4
|
|
|
|
|
37
|
|
15
|
4
|
|
|
4
|
|
1914
|
use Moose::Util::TypeConstraints 'role_type'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
32
|
|
16
|
4
|
|
|
4
|
|
1439
|
use namespace::autoclean; |
|
4
|
|
|
|
|
5170
|
|
|
4
|
|
|
|
|
21
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
with |
19
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileGatherer', |
20
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileMunger', |
21
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
22
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileFinderUser' => { |
23
|
|
|
|
|
|
|
method => 'found_files', |
24
|
|
|
|
|
|
|
finder_arg_names => [ 'finder' ], |
25
|
|
|
|
|
|
|
default_finders => [ ':InstallModules', ':ExecFiles', ':TestFiles' ], |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
'Dist::Zilla::Role::PrereqSource', |
28
|
|
|
|
|
|
|
; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has trailing_whitespace => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => 'Bool', |
33
|
|
|
|
|
|
|
default => 1, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has filename => ( |
37
|
|
|
|
|
|
|
is => 'ro', isa => 'Str', |
38
|
|
|
|
|
|
|
lazy => 1, |
39
|
|
|
|
|
|
|
default => sub { return 'xt/author/eol.t' }, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has files => ( |
43
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
44
|
|
|
|
|
|
|
traits => ['Array'], |
45
|
|
|
|
|
|
|
handles => { files => 'elements' }, |
46
|
|
|
|
|
|
|
lazy => 1, |
47
|
|
|
|
|
|
|
default => sub { [] }, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has _file_obj => ( |
51
|
|
|
|
|
|
|
is => 'rw', isa => role_type('Dist::Zilla::Role::File'), |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub mvp_multivalue_args { 'files' } |
55
|
4
|
|
|
4
|
0
|
563
|
sub mvp_aliases { return { file => 'files' } } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
around dump_config => sub |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
60
|
|
|
|
|
|
|
my $config = $self->$orig; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = { |
63
|
|
|
|
|
|
|
trailing_whitespace => $self->trailing_whitespace ? 1 : 0, |
64
|
|
|
|
|
|
|
filename => $self->filename, |
65
|
|
|
|
|
|
|
finder => [ sort @{ $self->finder } ], |
66
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
return $config; |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub gather_files |
72
|
|
|
|
|
|
|
{ |
73
|
4
|
|
|
4
|
0
|
188680
|
my $self = shift; |
74
|
|
|
|
|
|
|
|
75
|
4
|
|
|
|
|
2276
|
require Dist::Zilla::File::InMemory; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$self->add_file( |
78
|
|
|
|
|
|
|
$self->_file_obj( |
79
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new( |
80
|
|
|
|
|
|
|
name => $self->filename, |
81
|
4
|
|
|
|
|
232192
|
content => ${$self->section_data('__TEST__')}, |
|
4
|
|
|
|
|
31
|
|
82
|
|
|
|
|
|
|
) |
83
|
|
|
|
|
|
|
) |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
4
|
|
|
|
|
2391
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub munge_files |
90
|
|
|
|
|
|
|
{ |
91
|
4
|
|
|
4
|
0
|
5492
|
my $self = shift; |
92
|
|
|
|
|
|
|
|
93
|
12
|
|
|
|
|
2027
|
my @filenames = map { path($_->name)->relative('.')->stringify } |
94
|
12
|
|
33
|
|
|
8303
|
grep { not ($_->can('is_bytes') and $_->is_bytes) } |
95
|
4
|
|
|
|
|
7
|
@{ $self->found_files }; |
|
4
|
|
|
|
|
22
|
|
96
|
4
|
|
|
|
|
1023
|
push @filenames, $self->files; |
97
|
|
|
|
|
|
|
|
98
|
4
|
|
|
|
|
23
|
$self->log_debug('adding file ' . $_) foreach @filenames; |
99
|
|
|
|
|
|
|
|
100
|
4
|
|
|
|
|
2861
|
my $file = $self->_file_obj; |
101
|
4
|
|
|
|
|
20
|
$file->content( |
102
|
|
|
|
|
|
|
$self->fill_in_string( |
103
|
|
|
|
|
|
|
$file->content, |
104
|
|
|
|
|
|
|
{ |
105
|
|
|
|
|
|
|
dist => \($self->zilla), |
106
|
|
|
|
|
|
|
plugin => \$self, |
107
|
|
|
|
|
|
|
filenames => [ sort @filenames ], |
108
|
|
|
|
|
|
|
trailing_ws => \$self->trailing_whitespace, |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
) |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
|
113
|
4
|
|
|
|
|
5447
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub register_prereqs |
117
|
|
|
|
|
|
|
{ |
118
|
4
|
|
|
4
|
0
|
1294
|
my $self = shift; |
119
|
4
|
|
|
|
|
106
|
$self->zilla->register_prereqs( |
120
|
|
|
|
|
|
|
{ |
121
|
|
|
|
|
|
|
phase => 'develop', |
122
|
|
|
|
|
|
|
type => 'requires', |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
'Test::More' => '0.88', |
125
|
|
|
|
|
|
|
'Test::EOL' => '0', |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#pod =pod |
133
|
|
|
|
|
|
|
#pod |
134
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
135
|
|
|
|
|
|
|
#pod |
136
|
|
|
|
|
|
|
#pod Generate an author L<Test::EOL>. |
137
|
|
|
|
|
|
|
#pod |
138
|
|
|
|
|
|
|
#pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing |
139
|
|
|
|
|
|
|
#pod the file F<xt/author/eol.t>, a standard L<Test::EOL> test. |
140
|
|
|
|
|
|
|
#pod |
141
|
|
|
|
|
|
|
#pod =head1 CONFIGURATION OPTIONS |
142
|
|
|
|
|
|
|
#pod |
143
|
|
|
|
|
|
|
#pod This plugin accepts the following options: |
144
|
|
|
|
|
|
|
#pod |
145
|
|
|
|
|
|
|
#pod =head2 C<trailing_whitespace> |
146
|
|
|
|
|
|
|
#pod |
147
|
|
|
|
|
|
|
#pod If this option is set to a true value, |
148
|
|
|
|
|
|
|
#pod C<< { trailing_whitespace => 1 } >> will be passed to |
149
|
|
|
|
|
|
|
#pod L<Test::EOL/all_perl_files_ok>. It defaults to C<1>. |
150
|
|
|
|
|
|
|
#pod |
151
|
|
|
|
|
|
|
#pod What this option is going to do is test for the lack of trailing whitespace at |
152
|
|
|
|
|
|
|
#pod the end of the lines (also known as "trailing space"). |
153
|
|
|
|
|
|
|
#pod |
154
|
|
|
|
|
|
|
#pod =head2 C<finder> |
155
|
|
|
|
|
|
|
#pod |
156
|
|
|
|
|
|
|
#pod =for stopwords FileFinder |
157
|
|
|
|
|
|
|
#pod |
158
|
|
|
|
|
|
|
#pod This is the name of a L<FileFinder|Dist::Zilla::Role::FileFinder> for finding |
159
|
|
|
|
|
|
|
#pod files to check. The default value is C<:InstallModules>, |
160
|
|
|
|
|
|
|
#pod C<:ExecFiles> (see also L<Dist::Zilla::Plugin::ExecDir>) and C<:TestFiles>; |
161
|
|
|
|
|
|
|
#pod this option can be used more than once. |
162
|
|
|
|
|
|
|
#pod |
163
|
|
|
|
|
|
|
#pod Other predefined finders are listed in |
164
|
|
|
|
|
|
|
#pod L<Dist::Zilla::Role::FileFinderUser/default_finders>. |
165
|
|
|
|
|
|
|
#pod You can define your own with the |
166
|
|
|
|
|
|
|
#pod L<[FileFinder::ByName]|Dist::Zilla::Plugin::FileFinder::ByName> plugin. |
167
|
|
|
|
|
|
|
#pod |
168
|
|
|
|
|
|
|
#pod =head2 C<file> |
169
|
|
|
|
|
|
|
#pod |
170
|
|
|
|
|
|
|
#pod a filename to also test, in addition to any files found |
171
|
|
|
|
|
|
|
#pod earlier. This option can be repeated to specify multiple additional files. |
172
|
|
|
|
|
|
|
#pod |
173
|
|
|
|
|
|
|
#pod =head2 C<filename> |
174
|
|
|
|
|
|
|
#pod |
175
|
|
|
|
|
|
|
#pod The filename of the test to add - defaults to F<xt/author/test-eol.t>. |
176
|
|
|
|
|
|
|
#pod |
177
|
|
|
|
|
|
|
#pod =for Pod::Coverage mvp_multivalue_args mvp_aliases gather_files munge_files register_prereqs |
178
|
|
|
|
|
|
|
#pod |
179
|
|
|
|
|
|
|
#pod =head1 ACKNOWLEDGMENTS |
180
|
|
|
|
|
|
|
#pod |
181
|
|
|
|
|
|
|
#pod This module is a fork of L<Dist::Zilla::Plugin::EOLTests> and was originally |
182
|
|
|
|
|
|
|
#pod written by Florian Ragwitz. It was forked because the Test:: namespace |
183
|
|
|
|
|
|
|
#pod is preferred for test modules, and because I would prefer to have EOL tests |
184
|
|
|
|
|
|
|
#pod be Author tests. |
185
|
|
|
|
|
|
|
#pod |
186
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
187
|
|
|
|
|
|
|
#pod |
188
|
|
|
|
|
|
|
#pod =for :list |
189
|
|
|
|
|
|
|
#pod * Test::EOL |
190
|
|
|
|
|
|
|
#pod |
191
|
|
|
|
|
|
|
#pod =cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=pod |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=encoding UTF-8 |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 NAME |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Test::EOL - Author tests making sure correct line endings are used |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 VERSION |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
version 0.19 |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 DESCRIPTION |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Generate an author L<Test::EOL>. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing |
210
|
|
|
|
|
|
|
the file F<xt/author/eol.t>, a standard L<Test::EOL> test. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 CONFIGURATION OPTIONS |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This plugin accepts the following options: |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 C<trailing_whitespace> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
If this option is set to a true value, |
219
|
|
|
|
|
|
|
C<< { trailing_whitespace => 1 } >> will be passed to |
220
|
|
|
|
|
|
|
L<Test::EOL/all_perl_files_ok>. It defaults to C<1>. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
What this option is going to do is test for the lack of trailing whitespace at |
223
|
|
|
|
|
|
|
the end of the lines (also known as "trailing space"). |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head2 C<finder> |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=for stopwords FileFinder |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
This is the name of a L<FileFinder|Dist::Zilla::Role::FileFinder> for finding |
230
|
|
|
|
|
|
|
files to check. The default value is C<:InstallModules>, |
231
|
|
|
|
|
|
|
C<:ExecFiles> (see also L<Dist::Zilla::Plugin::ExecDir>) and C<:TestFiles>; |
232
|
|
|
|
|
|
|
this option can be used more than once. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Other predefined finders are listed in |
235
|
|
|
|
|
|
|
L<Dist::Zilla::Role::FileFinderUser/default_finders>. |
236
|
|
|
|
|
|
|
You can define your own with the |
237
|
|
|
|
|
|
|
L<[FileFinder::ByName]|Dist::Zilla::Plugin::FileFinder::ByName> plugin. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 C<file> |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
a filename to also test, in addition to any files found |
242
|
|
|
|
|
|
|
earlier. This option can be repeated to specify multiple additional files. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 C<filename> |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
The filename of the test to add - defaults to F<xt/author/test-eol.t>. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=for Pod::Coverage mvp_multivalue_args mvp_aliases gather_files munge_files register_prereqs |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 ACKNOWLEDGMENTS |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
This module is a fork of L<Dist::Zilla::Plugin::EOLTests> and was originally |
253
|
|
|
|
|
|
|
written by Florian Ragwitz. It was forked because the Test:: namespace |
254
|
|
|
|
|
|
|
is preferred for test modules, and because I would prefer to have EOL tests |
255
|
|
|
|
|
|
|
be Author tests. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 SEE ALSO |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=over 4 |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=item * |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Test::EOL |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=back |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head1 SUPPORT |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-EOL> |
270
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-Test-EOL@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-EOL@rt.cpan.org>). |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
273
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
276
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head1 AUTHORS |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=over 4 |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=item * |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Caleb Cushing <xenoterracide@gmail.com> |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item * |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=back |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=for stopwords Olivier Mengué Shlomi Fish |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=over 4 |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=item * |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
Olivier Mengué <dolmen@cpan.org> |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=item * |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
Shlomi Fish <shlomif@shlomifish.org> |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=back |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Florian Ragwitz <rafl@debian.org>. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
317
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
__DATA__ |
322
|
|
|
|
|
|
|
___[ __TEST__ ]___ |
323
|
|
|
|
|
|
|
use strict; |
324
|
|
|
|
|
|
|
use warnings; |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
# this test was generated with {{ ref $plugin }} {{ $plugin->VERSION }} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
use Test::More 0.88; |
329
|
|
|
|
|
|
|
use Test::EOL; |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
my @files = ( |
332
|
|
|
|
|
|
|
{{ join(",\n", map { " '" . $_ . "'" } map { s/'/\\'/g; $_ } @filenames) }} |
333
|
|
|
|
|
|
|
); |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
eol_unix_ok($_, { trailing_whitespace => {{ $trailing_ws }} }) foreach @files; |
336
|
|
|
|
|
|
|
done_testing; |