line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2606971
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
49
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
118
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Test::MinimumVersion; # git description: v2.000008-17-g357a037 |
6
|
|
|
|
|
|
|
# ABSTRACT: Author tests for minimum required versions |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.000009'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
12
|
use Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
34
|
|
11
|
|
|
|
|
|
|
with |
12
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileGatherer', |
13
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileMunger', |
14
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
15
|
|
|
|
|
|
|
'Dist::Zilla::Role::PrereqSource'; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
11812
|
use Sub::Exporter::ForMethods 'method_installer'; # method_installer returns a sub. |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
22
|
|
18
|
|
|
|
|
|
|
use Data::Section 0.004 # fixed header_re |
19
|
2
|
|
|
2
|
|
510
|
{ installer => method_installer }, '-setup'; |
|
2
|
|
|
|
|
49
|
|
|
2
|
|
|
|
|
14
|
|
20
|
2
|
|
|
2
|
|
1402
|
use List::Util 'first'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
168
|
|
21
|
2
|
|
|
2
|
|
15
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
20
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has max_target_perl => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => 'Str', |
26
|
|
|
|
|
|
|
predicate => 'has_max_target_perl', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
2
|
|
172
|
use constant FILENAME => 'xt/author/minimum-version.t'; # could be configurable, someday.. |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
849
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
around dump_config => sub |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
34
|
|
|
|
|
|
|
my $config = $self->$orig; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = +{ |
37
|
|
|
|
|
|
|
max_target_perl => $self->max_target_perl, |
38
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
return $config; |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub gather_files |
44
|
|
|
|
|
|
|
{ |
45
|
4
|
|
|
4
|
0
|
140144
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
4
|
|
|
|
|
1042
|
require Dist::Zilla::File::InMemory; |
48
|
|
|
|
|
|
|
$self->add_file( |
49
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new( |
50
|
|
|
|
|
|
|
name => FILENAME, |
51
|
4
|
|
|
|
|
157222
|
content => ${$self->section_data(FILENAME)}, |
|
4
|
|
|
|
|
38
|
|
52
|
|
|
|
|
|
|
) |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub munge_files |
57
|
|
|
|
|
|
|
{ |
58
|
4
|
|
|
4
|
0
|
11764
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
12
|
|
22
|
my $file = first { $_->name eq FILENAME } @{ $self->zilla->files }; |
|
12
|
|
|
|
|
473
|
|
|
4
|
|
|
|
|
118
|
|
61
|
4
|
|
|
|
|
161
|
$file->content( |
62
|
|
|
|
|
|
|
$self->fill_in_string( |
63
|
|
|
|
|
|
|
$file->content, |
64
|
|
|
|
|
|
|
{ (version => $self->max_target_perl)x!!$self->has_max_target_perl } |
65
|
|
|
|
|
|
|
) |
66
|
|
|
|
|
|
|
); |
67
|
4
|
|
|
|
|
4584
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#pod =for Pod::Coverage register_prereqs |
71
|
|
|
|
|
|
|
#pod |
72
|
|
|
|
|
|
|
#pod =cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub register_prereqs { |
75
|
4
|
|
|
4
|
0
|
1708
|
my $self = shift; |
76
|
4
|
|
|
|
|
111
|
$self->zilla->register_prereqs( |
77
|
|
|
|
|
|
|
{ |
78
|
|
|
|
|
|
|
type => 'requires', |
79
|
|
|
|
|
|
|
phase => 'develop', |
80
|
|
|
|
|
|
|
}, |
81
|
|
|
|
|
|
|
'Test::MinimumVersion' => 0, |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
89
|
|
|
|
|
|
|
#pod |
90
|
|
|
|
|
|
|
#pod In C<dist.ini>: |
91
|
|
|
|
|
|
|
#pod |
92
|
|
|
|
|
|
|
#pod [Test::MinimumVersion] |
93
|
|
|
|
|
|
|
#pod max_target_perl = 5.10.1 |
94
|
|
|
|
|
|
|
#pod |
95
|
|
|
|
|
|
|
#pod 1; |
96
|
|
|
|
|
|
|
#pod __END__ |
97
|
|
|
|
|
|
|
#pod |
98
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
99
|
|
|
|
|
|
|
#pod |
100
|
|
|
|
|
|
|
#pod =for Pod::Coverage FILENAME gather_files munge_files register_prereqs |
101
|
|
|
|
|
|
|
#pod |
102
|
|
|
|
|
|
|
#pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing a |
103
|
|
|
|
|
|
|
#pod L<Test::MinimumVersion> test: |
104
|
|
|
|
|
|
|
#pod |
105
|
|
|
|
|
|
|
#pod xt/author/minimum-version.t - a standard Test::MinimumVersion test |
106
|
|
|
|
|
|
|
#pod |
107
|
|
|
|
|
|
|
#pod You should provide the highest perl version you want to require as |
108
|
|
|
|
|
|
|
#pod C<target_max_version>. If you accidentally use perl features that are newer |
109
|
|
|
|
|
|
|
#pod than that version number, then the test will fail, and you can go change |
110
|
|
|
|
|
|
|
#pod whatever bumped up the minimum perl version required. |
111
|
|
|
|
|
|
|
#pod |
112
|
|
|
|
|
|
|
#pod =cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=pod |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=encoding UTF-8 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 NAME |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Test::MinimumVersion - Author tests for minimum required versions |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 VERSION |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
version 2.000009 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SYNOPSIS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
In C<dist.ini>: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
[Test::MinimumVersion] |
131
|
|
|
|
|
|
|
max_target_perl = 5.10.1 |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
134
|
|
|
|
|
|
|
__END__ |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 DESCRIPTION |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=for Pod::Coverage register_prereqs |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=for Pod::Coverage FILENAME gather_files munge_files register_prereqs |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing a |
143
|
|
|
|
|
|
|
L<Test::MinimumVersion> test: |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
xt/author/minimum-version.t - a standard Test::MinimumVersion test |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
You should provide the highest perl version you want to require as |
148
|
|
|
|
|
|
|
C<target_max_version>. If you accidentally use perl features that are newer |
149
|
|
|
|
|
|
|
than that version number, then the test will fail, and you can go change |
150
|
|
|
|
|
|
|
whatever bumped up the minimum perl version required. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SUPPORT |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-MinimumVersion> |
155
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-Test-MinimumVersion@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-MinimumVersion@rt.cpan.org>). |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
158
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
161
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHORS |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Mike Doherty <doherty@cpan.org> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Marcel Grünauer <marcel@cpan.org> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Marcel Gruenauer Chris Weyl Kent Fredric |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over 4 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Marcel Gruenauer <hanekomu@gmail.com> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Chris Weyl <cweyl@alumni.drew.edu> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item * |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Kent Fredric <kentfredric@gmail.com> |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=back |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Mike Doherty. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
206
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
__DATA__ |
211
|
|
|
|
|
|
|
___[ xt/author/minimum-version.t ]___ |
212
|
|
|
|
|
|
|
use strict; |
213
|
|
|
|
|
|
|
use warnings; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
use Test::More; |
216
|
|
|
|
|
|
|
use Test::MinimumVersion; |
217
|
|
|
|
|
|
|
{{ $version |
218
|
|
|
|
|
|
|
? "all_minimum_version_ok( qq{$version} );" |
219
|
|
|
|
|
|
|
: "all_minimum_version_from_metayml_ok();" |
220
|
|
|
|
|
|
|
}} |