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