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