blib/lib/Dist/Zilla/Plugin/Test/CPAN/Changes.pm

filter: Statementstmt 89.1% 33 / 37 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 2 totaltotal 78.8% 41 / 52 CC 3 SCAR 13.9
CC
3
Cov
80%
__ANON__
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
↑ Summary
1 package Dist::Zilla::Plugin::Test::CPAN::Changes; # git description: v0.012-5-g02db9b7
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 # ABSTRACT: release tests for your changelog
5  
6 1 our $VERSION = '0.013';
7  
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Sub::Exporter::ForMethods;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Data::Section 0.200002 { installer => Sub::Exporter::ForMethods::method_installer }, '-setup';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 with
13 'Dist::Zilla::Role::FileGatherer',
14 'Dist::Zilla::Role::PrereqSource',
15 'Dist::Zilla::Role::TextTemplate';
16  
17 #pod =head1 SYNOPSIS
18 #pod
19 #pod In C<dist.ini>:
20 #pod
21 #pod [Test::CPAN::Changes]
22 #pod
23 #pod =begin :prelude
24 #pod
25 #pod =for test_synopsis BEGIN { die "SKIP: synopsis isn't perl code" }
26 #pod
27 #pod =end :prelude
28 #pod
29 #pod =head1 DESCRIPTION
30 #pod
31 #pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
32 #pod following file:
33 #pod
34 #pod xt/release/cpan-changes.t - a standard Test::CPAN::Changes test
35 #pod
36 #pod See L<Test::CPAN::Changes> for what this test does.
37 #pod
38 #pod =head1 CONFIGURATION OPTIONS
39 #pod
40 #pod =head2 changelog
41 #pod
42 #pod The file name of the change log file to test. Defaults to F<Changes>.
43 #pod
44 #pod If you want to use a different filename for whatever reason, do:
45 #pod
46 #pod [Test::CPAN::Changes]
47 #pod changelog = CHANGES
48 #pod
49 #pod and that file will be tested instead.
50 #pod
51 #pod =head2 filename
52 #pod
53 #pod The name of the test file to be generated. Defaults to
54 #pod F<xt/release/cpan-changes.t>.
55 #pod
56 #pod =cut
57  
58 1 has changelog => (
59 is => 'ro',
60 isa => 'Str',
61 default => 'Changes',
62 );
63  
64 1 has filename => (
65 is => 'ro',
66 isa => 'Str',
67 default => 'xt/release/cpan-changes.t',
68 );
69  
70 around dump_config => sub
71 0 ▶{
Subroutine __ANON__: not called CC=3 SCAR=24.8
72 0 my ($orig, $self) = @_;
73 0 my $config = $self->$orig;
74  
75 0 ▶ $config->{+__PACKAGE__} = {
Branch: 2 branches
BranchTrueFalseTotal
builtin::blessed($self) ne __PACKAGE__ ? : 0 0 0
defined __PACKAGE__->VERSION ? : 0 0 0
76 changelog => $self->changelog,
77 filename => $self->filename,
78 blessed($self) ne __PACKAGE__
79 ? ( version => (defined __PACKAGE__->VERSION ? __PACKAGE__->VERSION : 'dev') )
80 : (),
81 };
82 0 return $config;
83 1 };
84  
85 #pod =for Pod::Coverage gather_files register_prereqs
86 #pod
87 #pod =cut
88  
89 2 ▶sub gather_files {
Subroutine gather_files: called CC=1 SCAR=0.0
Pod undocumented
90 2 my $self = shift;
91  
92 2 require Dist::Zilla::File::InMemory;
93  
94 2 my $content = ${$self->section_data('__TEST__')};
95  
96 2 my $final_content = $self->fill_in_string(
97 $content,
98 {
99 changes_filename => \($self->changelog),
100 plugin => \$self,
101 },
102 );
103  
104 2 $self->add_file( Dist::Zilla::File::InMemory->new(
105 name => $self->filename,
106 content => $final_content,
107 ));
108  
109 2 return;
110 }
111  
112 # Register the release test prereq as a "develop requires"
113 # so it will be listed in "dzil listdeps --author"
114 2 ▶sub register_prereqs {
Subroutine register_prereqs: called CC=1 SCAR=0.0
Pod undocumented
115 2 my ($self) = @_;
116  
117 2 $self->zilla->register_prereqs(
118 {
119 type => 'requires',
120 phase => 'develop',
121 },
122 # Latest known release of Test::CPAN::Changes
123 # because CPAN authors must use the latest if we want
124 # this check to be relevant
125 'Test::CPAN::Changes' => '0.19',
126 );
127 }
128  
129  
130  
131  
132  
133 1 __PACKAGE__->meta->make_immutable;
134 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
135  
136 =pod
137  
138 =encoding UTF-8
139  
140 =head1 NAME
141  
142 Dist::Zilla::Plugin::Test::CPAN::Changes - release tests for your changelog
143  
144 =head1 VERSION
145  
146 version 0.013
147  
148 =for test_synopsis BEGIN { die "SKIP: synopsis isn't perl code" }
149  
150 =head1 SYNOPSIS
151  
152 In C<dist.ini>:
153  
154 [Test::CPAN::Changes]
155  
156 =head1 DESCRIPTION
157  
158 This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
159 following file:
160  
161 xt/release/cpan-changes.t - a standard Test::CPAN::Changes test
162  
163 See L<Test::CPAN::Changes> for what this test does.
164  
165 =head1 CONFIGURATION OPTIONS
166  
167 =head2 changelog
168  
169 The file name of the change log file to test. Defaults to F<Changes>.
170  
171 If you want to use a different filename for whatever reason, do:
172  
173 [Test::CPAN::Changes]
174 changelog = CHANGES
175  
176 and that file will be tested instead.
177  
178 =head2 filename
179  
180 The name of the test file to be generated. Defaults to
181 F<xt/release/cpan-changes.t>.
182  
183 =for Pod::Coverage gather_files register_prereqs
184  
185 =head1 SUPPORT
186  
187 Bugs may be submitted through L<https://github.com/doherty/Dist-Zilla-Plugin-Test-CPAN-Changes/issues>.
188  
189 There is also a mailing list available for users of this distribution, at
190 L<http://dzil.org/#mailing-list>.
191  
192 There is also an irc channel available for users of this distribution, at
193 L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>.
194  
195 I am also usually active on irc, as 'ether' at C<irc.perl.org> and C<irc.libera.chat>.
196  
197 =head1 AUTHOR
198  
199 Mike Doherty <doherty@cpan.org>
200  
201 =head1 CONTRIBUTORS
202  
203 =for stopwords Mike Doherty Karen Etheridge Olivier Mengué Graham Knop Kent Fredric Mark Gardner Nelo Onyiah
204  
205 =over 4
206  
207 =item *
208  
209 Mike Doherty <mike@mikedoherty.ca>
210  
211 =item *
212  
213 Karen Etheridge <ether@cpan.org>
214  
215 =item *
216  
217 Olivier Mengué <dolmen@cpan.org>
218  
219 =item *
220  
221 Graham Knop <haarg@haarg.org>
222  
223 =item *
224  
225 Kent Fredric <kentfredric@gmail.com>
226  
227 =item *
228  
229 Mark Gardner <mgardner@ariasystems.com>
230  
231 =item *
232  
233 Nelo Onyiah <nelo.onyiah@gmail.com>
234  
235 =back
236  
237 =head1 COPYRIGHT AND LICENCE
238  
239 This software is copyright (c) 2011 by Mike Doherty.
240  
241 This is free software; you can redistribute it and/or modify it under
242 the same terms as the Perl 5 programming language system itself.
243  
244 =cut
245  
246 __DATA__
↑ Summary