Plugin/Test/PrereqsFromMeta.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 57.1% 16 / 28 CC 2 SCAR 11.0
CC
2
Cov
57%
prune_files
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Plugin/Metadata.pm ↑ Summary Plugin/ArchiveRelease.pm »
1 #---------------------------------------------------------------------
2 package Dist::Zilla::Plugin::Test::PrereqsFromMeta;
3 #
4 # Copyright 2011 Christopher J. Madsen
5 #
6 # Author: Christopher J. Madsen <perl@cjmweb.net>
7 # Created: 22 Nov 2011
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the same terms as Perl itself.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the
15 # GNU General Public License or the Artistic License for more details.
16 #
17 # ABSTRACT: Check the prereqs from our META.json
18 #---------------------------------------------------------------------
19  
20 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 our $VERSION = '4.23';
22 # This file is part of Dist-Zilla-Plugins-CJM 6.000 (December 17, 2017)
23  
24  
25 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 extends 'Dist::Zilla::Plugin::InlineFiles';
27 1 with 'Dist::Zilla::Role::FilePruner';
28  
29 #---------------------------------------------------------------------
30 # Make sure we've included a META.json:
31  
32 sub prune_files
33 0 ▶{
Subroutine prune_files: not called CC=2 SCAR=17.9
Pod undocumented
34 0 my $self = shift;
35  
36 0 my $files = $self->zilla->files;
37  
38 0 ▶ unless (grep { $_->name eq 'META.json' } @$files) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$_->name eq "META.json";} @$files) 0 0 0
39 0 $self->log("WARNING: META.json not found, removing t/00-all_prereqs.t");
40 0 @$files = grep { $_->name ne 't/00-all_prereqs.t' } @$files;
41 } # end unless META.json
42  
43 0 return;
44 } # end prune_files
45  
46 #---------------------------------------------------------------------
47 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 1 __PACKAGE__->meta->make_immutable;
49 1 1;
50  
51 =head1 NAME
52  
53 Dist::Zilla::Plugin::Test::PrereqsFromMeta - Check the prereqs from our META.json
54  
55 =head1 VERSION
56  
57 This document describes version 4.23 of
58 Dist::Zilla::Plugin::Test::PrereqsFromMeta, released December 17, 2017
59 as part of Dist-Zilla-Plugins-CJM version 6.000.
60  
61 =head1 SYNOPSIS
62  
63 In your F<dist.ini>:
64  
65 [Test::PrereqsFromMeta]
66  
67 =head1 DESCRIPTION
68  
69 This plugin will inject F<t/00-all_prereqs.t> into your dist. This
70 test reads your F<META.json> file and attempts to load all runtime
71 prerequisites. It fails if any required runtime prerequisites fail to
72 load. (If the loaded version is less than the required version, it
73 prints a warning message but the test does not fail.)
74  
75 In addition, if C<AUTOMATED_TESTING> is set, it dumps out every module
76 in C<%INC> along with its version. This can help you determine the
77 cause of failures reported by CPAN Testers.
78  
79 You can also get the version dump by running F<t/00-all_prereqs.t> with
80 the C<-v> or C<--verbose> option. (This is not the same as passing
81 the C<-v> option to C<prove>.)
82  
83  
84 =for Pod::Coverage
85 prune_files
86  
87 =head1 INCOMPATIBILITIES
88  
89 None reported.
90  
91 =head1 BUGS AND LIMITATIONS
92  
93 No bugs have been reported.
94  
95 =head1 AUTHOR
96  
97 Christopher J. Madsen S<C<< <perl AT cjmweb.net> >>>
98  
99 Please report any bugs or feature requests
100 to S<C<< <bug-Dist-Zilla-Plugins-CJM AT rt.cpan.org> >>>
101 or through the web interface at
102 L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugins-CJM >>.
103  
104 You can follow or contribute to Dist-Zilla-Plugins-CJM's development at
105 L<< https://github.com/madsen/dist-zilla-plugins-cjm >>.
106  
107 =head1 COPYRIGHT AND LICENSE
108  
109 This software is copyright (c) 2017 by Christopher J. Madsen.
110  
111 This is free software; you can redistribute it and/or modify it under
112 the same terms as the Perl 5 programming language system itself.
113  
114 =head1 DISCLAIMER OF WARRANTY
115  
116 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
117 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
118 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
119 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
120 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
121 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
122 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
123 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
124 NECESSARY SERVICING, REPAIR, OR CORRECTION.
125  
126 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
127 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
128 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
129 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
130 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
131 THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
132 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
133 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
134 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
135 SUCH DAMAGES.
136  
137 =cut
138  
139 __DATA__
« Plugin/Metadata.pm ↑ Summary Plugin/ArchiveRelease.pm »