/usr/share/perl5/Dist/Zilla/Plugin/Test/NoTabs.pm is in libdist-zilla-plugin-test-notabs-perl 0.15-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 | package Dist::Zilla::Plugin::Test::NoTabs; # git description: v0.14-9-g96d3b3c
# ABSTRACT: Author tests that ensure hard tabs are not used
# KEYWORDS: plugin test testing author development whitespace tab tabstop indent formatting
# vim: set ts=8 sts=4 sw=4 tw=78 et :
our $VERSION = '0.15';
use Moose;
use Path::Tiny;
use Sub::Exporter::ForMethods 'method_installer'; # method_installer returns a sub.
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 filename => (
is => 'ro', isa => 'Str',
lazy => 1,
default => sub { return 'xt/author/no-tabs.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 { qw(files module_finder script_finder) }
sub mvp_aliases { return { file => 'files' } }
around BUILDARGS => sub
{
my $orig = shift;
my $self = shift;
my $args = $self->$orig(@_);
# handle legacy args
my $module_finder = delete $args->{module_finder};
my $script_finder = delete $args->{script_finder};
if ($module_finder or $script_finder)
{
$args->{zilla}->log('folding deprecated options (module_finder, script_finder) into finder');
$args->{finder} = [ $args->finder ] if $args->{finder} and not ref $args->{finder};
push @{$args->{finder}},
$module_finder
? (ref $module_finder ? @$module_finder : $module_finder)
: ':InstallModules';
push @{$args->{finder}},
$script_finder
? (ref $script_finder ? @$script_finder : $script_finder)
: (':ExecFiles', ':TestFiles');
}
return $args;
};
around dump_config => sub
{
my ($orig, $self) = @_;
my $config = $self->$orig;
$config->{+__PACKAGE__} = {
finder => $self->finder,
filename => $self->filename,
};
return $config;
};
sub register_prereqs
{
my $self = shift;
$self->zilla->register_prereqs(
{
type => 'requires',
phase => 'develop',
},
'Test::More' => '0.88',
'Test::NoTabs' => '0',
);
}
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 => \@filenames,
}
)
);
return;
}
__PACKAGE__->meta->make_immutable;
#pod =pod
#pod
#pod =for Pod::Coverage::TrustPod
#pod mvp_aliases
#pod register_prereqs
#pod gather_files
#pod munge_files
#pod
#pod =head1 SYNOPSIS
#pod
#pod In your F<dist.ini>:
#pod
#pod [Test::NoTabs]
#pod finder = my_finder
#pod finder = other_finder
#pod
#pod =head1 DESCRIPTION
#pod
#pod This is a plugin that runs at the L<gather files|Dist::Zilla::Role::FileGatherer> stage,
#pod providing the file F<xt/author/no-tabs.t>, a standard L<Test::NoTabs> test.
#pod
#pod =head1 CONFIGURATION OPTIONS
#pod
#pod This plugin accepts the following options:
#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/no-tabs.t>.
#pod
#pod =head1 SEE ALSO
#pod
#pod =for :list
#pod * Test::NoTabs
#pod * Test::Tabs
#pod
#pod =cut
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::Plugin::Test::NoTabs - Author tests that ensure hard tabs are not used
=head1 VERSION
version 0.15
=head1 SYNOPSIS
In your F<dist.ini>:
[Test::NoTabs]
finder = my_finder
finder = other_finder
=head1 DESCRIPTION
This is a plugin that runs at the L<gather files|Dist::Zilla::Role::FileGatherer> stage,
providing the file F<xt/author/no-tabs.t>, a standard L<Test::NoTabs> test.
=for Pod::Coverage::TrustPod mvp_aliases
register_prereqs
gather_files
munge_files
=head1 CONFIGURATION OPTIONS
This plugin accepts the following options:
=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/no-tabs.t>.
=head1 SEE ALSO
=over 4
=item *
Test::NoTabs
=item *
Test::Tabs
=back
=head1 AUTHOR
Florian Ragwitz <rafl@debian.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 CONTRIBUTORS
=for stopwords Karen Etheridge Noel Maddy
=over 4
=item *
Karen Etheridge <ether@cpan.org>
=item *
Noel Maddy <zhtwnpanta@gmail.com>
=back
=cut
__DATA__
___[ __TEST__ ]___
use strict;
use warnings;
# this test was generated with {{ ref($plugin) . ' ' . $plugin->VERSION }}
use Test::More 0.88;
use Test::NoTabs;
my @files = (
{{ join(",\n", map { " '" . $_ . "'" } map { s/'/\\'/g; $_ } sort @filenames) }}
);
notabs_ok($_) foreach @files;
done_testing;
|