| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Test::Version; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1977636
|
use Moose; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
with |
|
6
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileGatherer', |
|
7
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileMunger', |
|
8
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
|
9
|
|
|
|
|
|
|
'Dist::Zilla::Role::PrereqSource', |
|
10
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileFinderUser' => { |
|
11
|
|
|
|
|
|
|
method => 'found_files', |
|
12
|
|
|
|
|
|
|
finder_arg_names => [ 'finder' ], |
|
13
|
|
|
|
|
|
|
default_finders => [], |
|
14
|
|
|
|
|
|
|
}, |
|
15
|
|
|
|
|
|
|
; |
|
16
|
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
16405
|
use Sub::Exporter::ForMethods 'method_installer'; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
|
|
use Data::Section 0.004 # fixed header_re |
|
19
|
4
|
|
|
4
|
|
647
|
{ installer => method_installer }, '-setup'; |
|
|
4
|
|
|
|
|
113
|
|
|
|
4
|
|
|
|
|
20
|
|
|
20
|
4
|
|
|
4
|
|
1933
|
use Moose::Util::TypeConstraints qw( role_type union enum ); |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
28
|
|
|
21
|
4
|
|
|
4
|
|
1508
|
use namespace::autoclean; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
30
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# ABSTRACT: Author Test::Version tests |
|
24
|
|
|
|
|
|
|
our $VERSION = '1.08'; # VERSION |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub gather_files { |
|
27
|
5
|
|
|
5
|
0
|
169229
|
my($self) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
5
|
|
|
|
|
1991
|
require Dist::Zilla::File::InMemory; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->add_file( |
|
32
|
|
|
|
|
|
|
$self->_file_obj( |
|
33
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new( |
|
34
|
|
|
|
|
|
|
# PRs welcome: make configurable. |
|
35
|
|
|
|
|
|
|
name => 'xt/author/test-version.t', |
|
36
|
5
|
|
|
|
|
223198
|
content => ${$self->section_data('__TEST__')}, |
|
|
5
|
|
|
|
|
27
|
|
|
37
|
|
|
|
|
|
|
) |
|
38
|
|
|
|
|
|
|
) |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
1432
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub munge_files |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
5
|
|
|
5
|
0
|
6139
|
my($self) = @_; |
|
47
|
|
|
|
|
|
|
|
|
48
|
5
|
|
|
|
|
8
|
my @filenames; |
|
49
|
5
|
|
|
|
|
9
|
my $use_finder = 0; |
|
50
|
|
|
|
|
|
|
|
|
51
|
5
|
100
|
|
|
|
5
|
if(@{ $self->finder } > 0) { |
|
|
5
|
|
|
|
|
147
|
|
|
52
|
1
|
|
|
|
|
43
|
@filenames = map { $_->name } |
|
53
|
1
|
|
33
|
|
|
624
|
grep { not ($_->can('is_bytes') and $_->is_bytes) } |
|
54
|
1
|
|
|
|
|
8
|
@{ $self->found_files }; |
|
|
1
|
|
|
|
|
4
|
|
|
55
|
1
|
|
|
|
|
31
|
$use_finder = 1; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
5
|
|
|
|
|
165
|
my $file = $self->_file_obj; |
|
59
|
|
|
|
|
|
|
$file->content( |
|
60
|
|
|
|
|
|
|
$self->fill_in_string( |
|
61
|
|
|
|
|
|
|
$file->content, |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
|
|
|
|
|
|
name => __PACKAGE__, |
|
64
|
|
|
|
|
|
|
version => __PACKAGE__->VERSION |
|
65
|
|
|
|
|
|
|
|| 'bootstrapped version' |
|
66
|
|
|
|
|
|
|
, |
|
67
|
|
|
|
|
|
|
is_strict => \$self->_is_strict, |
|
68
|
|
|
|
|
|
|
has_version => \$self->has_version, |
|
69
|
|
|
|
|
|
|
multiple => \$self->multiple, |
|
70
|
5
|
|
50
|
|
|
24
|
filename_match => join(", ", @{ $self->filename_match }), |
|
|
5
|
|
|
|
|
156
|
|
|
71
|
|
|
|
|
|
|
filenames => [ sort @filenames ], |
|
72
|
|
|
|
|
|
|
use_finder => $use_finder, |
|
73
|
|
|
|
|
|
|
}, |
|
74
|
|
|
|
|
|
|
) |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
|
|
77
|
5
|
|
|
|
|
7987
|
return; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub register_prereqs { |
|
81
|
5
|
|
|
5
|
1
|
1441
|
my $self = shift; |
|
82
|
|
|
|
|
|
|
$self->zilla->register_prereqs({ |
|
83
|
|
|
|
|
|
|
type => 'requires', |
|
84
|
|
|
|
|
|
|
phase => 'develop', |
|
85
|
|
|
|
|
|
|
}, |
|
86
|
|
|
|
|
|
|
'Test::More' => 0, |
|
87
|
5
|
100
|
|
|
|
131
|
'Test::Version' => @{ $self->filename_match } > 0 ? '2.00' : '1', |
|
|
5
|
|
|
|
|
165
|
|
|
88
|
|
|
|
|
|
|
); |
|
89
|
5
|
|
|
|
|
2410
|
return; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has is_strict => ( |
|
93
|
|
|
|
|
|
|
is => 'ro', |
|
94
|
|
|
|
|
|
|
isa => union([ 'Bool', enum(['adaptive']) ]), |
|
95
|
|
|
|
|
|
|
lazy => 1, |
|
96
|
|
|
|
|
|
|
default => sub { 0 }, |
|
97
|
|
|
|
|
|
|
); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
has _is_strict => ( |
|
100
|
|
|
|
|
|
|
is => 'ro', |
|
101
|
|
|
|
|
|
|
isa => 'Bool', |
|
102
|
|
|
|
|
|
|
lazy => 1, |
|
103
|
|
|
|
|
|
|
init_arg => undef, |
|
104
|
|
|
|
|
|
|
default => sub { |
|
105
|
|
|
|
|
|
|
my($self) = @_; |
|
106
|
|
|
|
|
|
|
$self->is_strict eq 'adaptive' ? ($self->zilla->is_trial ? 0 : 1) : $self->is_strict |
|
107
|
|
|
|
|
|
|
}, |
|
108
|
|
|
|
|
|
|
); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
has has_version => ( |
|
111
|
|
|
|
|
|
|
is => 'ro', |
|
112
|
|
|
|
|
|
|
isa => 'Bool', |
|
113
|
|
|
|
|
|
|
lazy => 1, |
|
114
|
|
|
|
|
|
|
default => sub { 1 }, |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
has multiple => ( |
|
118
|
|
|
|
|
|
|
is => 'ro', |
|
119
|
|
|
|
|
|
|
isa => 'Bool', |
|
120
|
|
|
|
|
|
|
lazy => 1, |
|
121
|
|
|
|
|
|
|
default => sub { 0 }, |
|
122
|
|
|
|
|
|
|
); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
has filename_match => ( |
|
125
|
|
|
|
|
|
|
is => 'ro', |
|
126
|
|
|
|
|
|
|
isa => 'ArrayRef', |
|
127
|
|
|
|
|
|
|
lazy => 1, |
|
128
|
|
|
|
|
|
|
default => sub { [] }, |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
has _file_obj => ( |
|
132
|
|
|
|
|
|
|
is => 'rw', |
|
133
|
|
|
|
|
|
|
isa => role_type('Dist::Zilla::Role::File'), |
|
134
|
|
|
|
|
|
|
); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
around mvp_multivalue_args => sub { |
|
137
|
|
|
|
|
|
|
my($orig, $self) = @_; |
|
138
|
|
|
|
|
|
|
return ($self->$orig, 'filename_match'); |
|
139
|
|
|
|
|
|
|
}; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
142
|
|
|
|
|
|
|
1; |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=pod |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 NAME |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Test::Version - Author Test::Version tests |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 VERSION |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
version 1.08 |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
in C<dist.ini> |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
[Test::Version] |
|
159
|
|
|
|
|
|
|
is_strict = 0 |
|
160
|
|
|
|
|
|
|
has_version = 1 |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This module will add a L<Test::Version> test as a author test to your module. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 is_strict |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
set L<Test::Version is_strict|Test::Version/is_strict> |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
In addition to a boolean value, you may specify C<adaptive> to indicate that |
|
173
|
|
|
|
|
|
|
is_strict should be true for production releases, but false for trial or |
|
174
|
|
|
|
|
|
|
development releases. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 has_version |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
set L<Test::Version has_version|Test::Version/has_version> |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 filename_match |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
set L<Test::Version filename_match|Test::Version/filename_match> |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 multiple |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
set L<Test::Version multiple|Test::Version/multiple> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 finder |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This is the name of a L<Dist::Zilla::Role::FileFinder> for finding files to check. |
|
191
|
|
|
|
|
|
|
If this is specified then C<version_ok> will be used for each file that matches, |
|
192
|
|
|
|
|
|
|
otherwise C<version_all_ok> will be used, and the file discovery will be handled |
|
193
|
|
|
|
|
|
|
by L<Test::Version>. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 METHODS |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 register_prereqs |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Register L<Test::Version> as an a development prerequisite. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 BUGS |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
|
204
|
|
|
|
|
|
|
https://github.com/plicease/dist-zilla-plugin-test-version/issues |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
207
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
208
|
|
|
|
|
|
|
feature. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 AUTHORS |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=over 4 |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Caleb Cushing <xenoterracide@gmail.com> |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=back |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
This software is Copyright (c) 2016 by Caleb Cushing <xenoterracide@gmail.com>. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This is free software, licensed under: |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
__DATA__ |
|
235
|
|
|
|
|
|
|
__[ __TEST__ ]__ |
|
236
|
|
|
|
|
|
|
use strict; |
|
237
|
|
|
|
|
|
|
use warnings; |
|
238
|
|
|
|
|
|
|
use Test::More; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# generated by {{ $name }} {{ $version }} |
|
241
|
|
|
|
|
|
|
use Test::Version; |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my @imports = qw( {{ $use_finder ? 'version_ok' : 'version_all_ok' }} ); |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my $params = { |
|
246
|
|
|
|
|
|
|
is_strict => {{ $is_strict }}, |
|
247
|
|
|
|
|
|
|
has_version => {{ $has_version }}, |
|
248
|
|
|
|
|
|
|
multiple => {{ $multiple }}, |
|
249
|
|
|
|
|
|
|
{{ $filename_match ? " filename_match => [ $filename_match ]," : '' }} |
|
250
|
|
|
|
|
|
|
}; |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
push @imports, $params |
|
253
|
|
|
|
|
|
|
if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Test::Version->import(@imports); |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
{{ |
|
258
|
|
|
|
|
|
|
$use_finder |
|
259
|
|
|
|
|
|
|
? @filenames > 0 ? join("\n", map { s/'/\\'/g; "version_ok('$_');" } @filenames) : '# finder found no files' |
|
260
|
|
|
|
|
|
|
: 'version_all_ok;'; |
|
261
|
|
|
|
|
|
|
}} |
|
262
|
|
|
|
|
|
|
done_testing; |