File Coverage

blib/lib/Dist/Zilla/PluginBundle/TestingMania.pm
Criterion Covered Total %
statement 42 43 97.6
branch 8 12 66.6
condition 5 9 55.5
subroutine 12 12 100.0
pod 0 2 0.0
total 67 78 85.9


line stmt bran cond sub pod time code
1             package Dist::Zilla::PluginBundle::TestingMania;
2             # ABSTRACT: test your dist with every testing plugin conceivable
3 1     1   611729 use strict;
  1         1  
  1         31  
4 1     1   3 use warnings;
  1         2  
  1         42  
5             our $VERSION = '0.25'; # VERSION
6              
7 1     1   3 use List::MoreUtils qw( any );
  1         1  
  1         12  
8 1     1   280 use Moose;
  1         1  
  1         5  
9 1     1   4118 use namespace::autoclean;
  1         1  
  1         6  
10             with 'Dist::Zilla::Role::PluginBundle::Easy';
11              
12              
13             has enable => (
14             is => 'ro',
15             isa => 'ArrayRef[Str]',
16             lazy => 1,
17             default => sub { $_[0]->payload->{enable} || [] },
18             );
19              
20             has disable => (
21             is => 'ro',
22             isa => 'ArrayRef[Str]',
23             lazy => 1,
24             default => sub { $_[0]->payload->{disable} || [] },
25             );
26              
27 4     4 0 1096885 sub mvp_multivalue_args { qw(enable disable) }
28              
29             sub configure {
30 4     4 0 13 my $self = shift;
31              
32 4         12 my %plugins = (
33             'Test::CPAN::Changes' => $self->config_slice('changelog'),
34             'Test::CPAN::Meta::JSON'=> 1, # prunes itself if META.json isn't there
35             'Test::Pod::LinkCheck' => 1,
36             'Test::Version' => $self->config_slice('has_version', { strict_version => 'is_strict' }),
37             'Test::Compile' => 1,
38             'Test::Perl::Critic' => $self->config_slice('critic_config'),
39             'Test::DistManifest' => 1,
40             'Test::EOL' => 1,
41             'Test::Kwalitee' => 1,
42             MetaTests => 1, # should only be loaded if MetaYAML is loaded, or the file exists in the dist
43             'Test::MinimumVersion' => $self->config_slice('max_target_perl'),
44             MojibakeTests => 1,
45             'Test::NoTabs' => 1,
46             PodCoverageTests => 1,
47             PodSyntaxTests => 1,
48             'Test::Portability' => 1,
49             'Test::Synopsis' => 1,
50             'Test::UnusedVars' => 1,
51             );
52 4         547 my %synonyms = (
53             'NoTabsTests' => 'Test::NoTabs',
54             'EOLTests' => 'Test::EOL',
55             );
56 4         6 my @include = ();
57              
58 4 100       13 my @disable =
59 4         18 map { $synonyms{$_} ? $synonyms{$_} : $_ }
60 4         112 map { (split /,\s?/, $_) }
61 4         5 @{ $self->disable };
62 4         15 foreach my $plugin (keys %plugins) {
63             next if ( # Skip...
64 71     71   155 any { $_ eq $plugin } @disable or # plugins they asked to skip
65 72 50 66 562   161 any { $_ eq $plugin } @include or # plugins we already included
  562   66     470  
66             !$plugins{$plugin} # plugins in the list, but which we don't want to add
67             );
68 69 100       146 push(@include, ref $plugins{$plugin}
69             ? [ $plugin => $plugins{$plugin} ]
70             : $plugin);
71             }
72              
73 1 50       3 my @enable =
74 1         5 map { $synonyms{$_} ? $synonyms{$_} : $_ }
75 4         150 map { (split /,\s?/, $_) }
76 4         8 @{ $self->enable };
77 4         7 foreach my $plugin (@enable) {
78 1 50   21   6 next unless any { $_ eq $plugin } %plugins; # Skip the plugin unless it is in the list of actual testing plugins
  21         15  
79 1 50 33 11   4 push(@include, $plugin) unless ( any { $_ eq $plugin } @include or any { $_ eq $plugin } @disable);
  11         14  
  0         0  
80             }
81              
82 4         16 $self->add_plugins(@include);
83             }
84              
85             __PACKAGE__->meta->make_immutable();
86              
87 1     1   457 no Moose;
  1         1  
  1         5  
88              
89             1;
90              
91             __END__
92              
93             =pod
94              
95             =encoding UTF-8
96              
97             =head1 NAME
98              
99             Dist::Zilla::PluginBundle::TestingMania - test your dist with every testing plugin conceivable
100              
101             =head1 VERSION
102              
103             version 0.25
104              
105             =head1 SYNOPSIS
106              
107             In F<dist.ini>:
108              
109             [@TestingMania]
110              
111             =head1 DESCRIPTION
112              
113             This plugin bundle collects all the testing plugins for L<Dist::Zilla> which
114             exist (and are not deprecated). This is for the most paranoid people who
115             want to test their dist seven ways to Sunday.
116              
117             Simply add the following near the end of F<dist.ini>:
118              
119             [@TestingMania]
120              
121             =head2 Testing plugins
122              
123             =over 4
124              
125             =item *
126              
127             L<Dist::Zilla::Plugin::Test::Compile>, which performs tests to syntax check your
128             dist.
129              
130             =item *
131              
132             L<Dist::Zilla::Plugin::Test::Perl::Critic>, which checks your code against best
133             practices. See L<Test::Perl::Critic> and L<Perl::Critic> for details.
134              
135             You can set a perlcritic config file:
136              
137             [@TestingMania]
138             critic_config = perlcriticrc
139              
140             =item *
141              
142             L<Dist::Zilla::Plugin::Test::DistManifest>, which tests F<MANIFEST> for
143             correctness. See L<Test::DistManifest> for details.
144              
145             =item *
146              
147             L<Dist::Zilla::Plugin::Test::EOL>, which ensures the correct line endings are
148             used (and also checks for trailing whitespace). See L<Test::EOL> for details.
149              
150             =item *
151              
152             L<Dist::Zilla::Plugin::Test::Version>, which tests that your dist has
153             version numbers, and that they are valid. See L<Test::Version> for exactly
154             what that means.
155              
156             You can set C<strict_version> and C<has_version>, and they'll be passed through to
157             the plugin as C<is_strict> and C<has_version> respectively. See the
158             documentation of L<Test::Version> for a description of these options.
159              
160             =item *
161              
162             L<Dist::Zilla::Plugin::Test::Kwalitee>, which performs some basic kwalitee checks.
163             I<Kwalitee> is an automatically-measurable guage of how good your software is.
164             It bears only a B<superficial> resemblance to the human-measurable guage of
165             actual quality. See L<Test::Kwalitee> for a description of the tests.
166              
167             =item *
168              
169             L<Dist::Zilla::Plugin::MetaTests>, which performs some extra tests on
170             F<META.yml>. See L<Test::CPAN::Meta> for what that means.
171              
172             =item *
173              
174             L<Dist::Zilla::Plugin::Test::CPAN::Meta::JSON>, which performs some extra tests
175             on F<META.json>, if it exists. See L<Test::CPAN::Meta::JSON> for what that
176             means.
177              
178             =item *
179              
180             L<Dist::Zilla::Plugin::Test::MinimumVersion>, which tests for the minimum
181             required version of perl. Give the highest version of perl you intend to
182             require as C<max_target_perl>. The generated test will fail if you accidentally
183             used features from a version of perl newer than that. See
184             L<Test::MinimumVersion> for details and limitations.
185              
186             =item *
187              
188             L<Dist::Zilla::Plugin::MojibakeTests>, which tests for the correct
189             source/documentation character encoding.
190              
191             =item *
192              
193             L<Dist::Zilla::Plugin::Test::NoTabs>, which ensures you don't use I<The Evil
194             Character>. See L<Test::NoTabs> for details. If you wish to exclude this plugin,
195             see L</"Disabling Tests">.
196              
197             =item *
198              
199             L<Dist::Zilla::Plugin::PodCoverageTests>, which checks that you have Pod
200             documentation for the things you should have it for. See L<Test::Pod::Coverage>
201             for what that means.
202              
203             =item *
204              
205             L<Dist::Zilla::Plugin::PodSyntaxTests>, which checks that your Pod is
206             well-formed. See L<Test::Pod> and L<perlpod> for details.
207              
208             =item *
209              
210             L<Dist::Zilla::Plugin::Test::Portability>, which performs some basic tests to
211             ensure portability of file names. See L<Test::Portability::Files> for what
212             that means.
213              
214             =item *
215              
216             L<Dist::Zilla::Plugin::Test::Synopsis>, which does syntax checking on the code
217             from your SYNOPSIS section. See L<Test::Synopsis> for details and limitations.
218              
219             =item *
220              
221             L<Dist::Zilla::Plugin::Test::UnusedVars>, which checks your dist for unused
222             variables. See L<Test::Vars> for details.
223              
224             =item *
225              
226             L<Dist::Zilla::Plugin::Test::Pod::LinkCheck>, which checks the links in your POD.
227             See L<Test::Pod::LinkCheck> for details.
228              
229             =item *
230              
231             L<Dist::Zilla::Plugin::Test::CPAN::Changes>, which checks your changelog for
232             conformance with L<CPAN::Changes::Spec>. See L<Test::CPAN::Changes> for details.
233              
234             Set C<changelog> in F<dist.ini> if you don't use F<Changes>:
235              
236             [@TestingMania]
237             changelog = CHANGELOG
238              
239             =back
240              
241             =head2 Disabling Tests
242              
243             To exclude a testing plugin, specify them with C<disable> in F<dist.ini>
244              
245             [@TestingMania]
246             disable = Test::DistManifest
247             disable = Test::Kwalitee
248              
249             =head2 Enabling Tests
250              
251             This pluginbundle may have some testing plugins that aren't
252             enabled by default. This option allows you to turn them on. Attempting to add
253             plugins which are not listed above will have I<no effect>.
254              
255             To enable a testing plugin, specify them in F<dist.ini>:
256              
257             [@TestingMania]
258             enable = Test::Compile
259              
260             =for test_synopsis 1;
261             __END__
262              
263             =for Pod::Coverage configure mvp_multivalue_args
264              
265             =head1 AVAILABILITY
266              
267             The project homepage is L<http://metacpan.org/release/Dist-Zilla-PluginBundle-TestingMania/>.
268              
269             The latest version of this module is available from the Comprehensive Perl
270             Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN
271             site near you, or see L<https://metacpan.org/module/Dist::Zilla::PluginBundle::TestingMania/>.
272              
273             =head1 SOURCE
274              
275             The development version is on github at L<http://github.com/doherty/Dist-Zilla-PluginBundle-TestingMania>
276             and may be cloned from L<git://github.com/doherty/Dist-Zilla-PluginBundle-TestingMania.git>
277              
278             =head1 BUGS AND LIMITATIONS
279              
280             You can make new bug reports, and view existing ones, through the
281             web interface at L<https://github.com/doherty/Dist-Zilla-PluginBundle-TestingMania/issues>.
282              
283             =head1 AUTHOR
284              
285             Mike Doherty <doherty@cpan.org>
286              
287             =head1 COPYRIGHT AND LICENSE
288              
289             This software is copyright (c) 2010 by Mike Doherty.
290              
291             This is free software; you can redistribute it and/or modify it under
292             the same terms as the Perl 5 programming language system itself.
293              
294             =cut