| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::AutoVersion 6.030; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: take care of numbering versions so you don't have to |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2043
|
use Moose; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
|
|
with( |
|
6
|
|
|
|
|
|
|
'Dist::Zilla::Role::VersionProvider', |
|
7
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
|
8
|
|
|
|
|
|
|
); |
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
14809
|
use Dist::Zilla::Pragmas; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
15
|
use namespace::autoclean; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
15
|
|
|
|
|
|
|
#pod |
|
16
|
|
|
|
|
|
|
#pod This plugin automatically produces a version string, generally based on the |
|
17
|
|
|
|
|
|
|
#pod current time. By default, it will be in the format: 1.yyDDDn |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod =cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#pod =attr major |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod The C<major> attribute is just an integer that is meant to store the major |
|
24
|
|
|
|
|
|
|
#pod version number. If no value is specified in configuration, it will default to |
|
25
|
|
|
|
|
|
|
#pod 1. |
|
26
|
|
|
|
|
|
|
#pod |
|
27
|
|
|
|
|
|
|
#pod This attribute's value can be referred to in the autoversion format template. |
|
28
|
|
|
|
|
|
|
#pod |
|
29
|
|
|
|
|
|
|
#pod =cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has major => ( |
|
32
|
|
|
|
|
|
|
is => 'ro', |
|
33
|
|
|
|
|
|
|
isa => 'Int', |
|
34
|
|
|
|
|
|
|
required => 1, |
|
35
|
|
|
|
|
|
|
default => 1, |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#pod =attr format |
|
39
|
|
|
|
|
|
|
#pod |
|
40
|
|
|
|
|
|
|
#pod The format is a L<Text::Template> string that will be rendered to form the |
|
41
|
|
|
|
|
|
|
#pod version. It is meant to access to one variable, C<$major>, and one subroutine, |
|
42
|
|
|
|
|
|
|
#pod C<cldr>, which will format the current time (in GMT) using CLDR patterns (for |
|
43
|
|
|
|
|
|
|
#pod which consult the L<DateTime> documentation). |
|
44
|
|
|
|
|
|
|
#pod |
|
45
|
|
|
|
|
|
|
#pod The default value is: |
|
46
|
|
|
|
|
|
|
#pod |
|
47
|
|
|
|
|
|
|
#pod {{ $major }}.{{ cldr('yyDDD') }} |
|
48
|
|
|
|
|
|
|
#pod {{ sprintf('%01u', ($ENV{N} || 0)) }} |
|
49
|
|
|
|
|
|
|
#pod {{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}} |
|
50
|
|
|
|
|
|
|
#pod |
|
51
|
|
|
|
|
|
|
#pod =cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has time_zone => ( |
|
54
|
|
|
|
|
|
|
is => 'ro', |
|
55
|
|
|
|
|
|
|
isa => 'Str', |
|
56
|
|
|
|
|
|
|
required => 1, |
|
57
|
|
|
|
|
|
|
default => 'GMT', |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
has format => ( |
|
61
|
|
|
|
|
|
|
is => 'ro', |
|
62
|
|
|
|
|
|
|
isa => 'Str', |
|
63
|
|
|
|
|
|
|
required => 1, |
|
64
|
|
|
|
|
|
|
default => q<{{ $major }}.{{ cldr('yyDDD') }}> |
|
65
|
|
|
|
|
|
|
. q<{{ sprintf('%01u', ($ENV{N} || 0)) }}> |
|
66
|
|
|
|
|
|
|
. q<{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}}> |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub provide_version { |
|
70
|
3
|
|
|
3
|
0
|
12
|
my ($self) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
3
|
100
|
|
|
|
14
|
if (exists $ENV{V}) { |
|
73
|
1
|
|
|
|
|
7
|
$self->log_debug([ 'providing version %s', $ENV{V} ]); |
|
74
|
1
|
|
|
|
|
30
|
return $ENV{V}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# TODO declare this as a 'develop' prereq as we want it in |
|
78
|
|
|
|
|
|
|
# `dzil listdeps --author` |
|
79
|
2
|
|
|
|
|
2202
|
require DateTime; |
|
80
|
2
|
|
|
|
|
397742
|
DateTime->VERSION('0.44'); # CLDR fixes |
|
81
|
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
9
|
my $now; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $version = $self->fill_in_string( |
|
85
|
|
|
|
|
|
|
$self->format, |
|
86
|
|
|
|
|
|
|
{ |
|
87
|
|
|
|
|
|
|
major => \( $self->major ), |
|
88
|
|
|
|
|
|
|
cldr => sub { |
|
89
|
1
|
|
33
|
1
|
|
580
|
$now ||= do { |
|
90
|
1
|
|
|
|
|
7
|
require DateTime; |
|
91
|
1
|
|
|
|
|
14
|
DateTime->VERSION('0.44'); # CLDR fixes |
|
92
|
1
|
|
|
|
|
44
|
DateTime->now(time_zone => $self->time_zone); |
|
93
|
|
|
|
|
|
|
}; |
|
94
|
1
|
|
|
|
|
924
|
$now->format_cldr($_[0]) |
|
95
|
|
|
|
|
|
|
}, |
|
96
|
|
|
|
|
|
|
}, |
|
97
|
2
|
|
|
|
|
113
|
); |
|
98
|
|
|
|
|
|
|
|
|
99
|
2
|
|
|
|
|
24
|
$self->log_debug([ 'providing version %s', $version ]); |
|
100
|
|
|
|
|
|
|
|
|
101
|
2
|
|
|
|
|
224
|
return $version; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
105
|
|
|
|
|
|
|
1; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
|
108
|
|
|
|
|
|
|
#pod |
|
109
|
|
|
|
|
|
|
#pod Core Dist::Zilla plugins: |
|
110
|
|
|
|
|
|
|
#pod L<PkgVersion|Dist::Zilla::Plugin::PkgVersion>, |
|
111
|
|
|
|
|
|
|
#pod L<PodVersion|Dist::Zilla::Plugin::PodVersion>, |
|
112
|
|
|
|
|
|
|
#pod L<NextRelease|Dist::Zilla::Plugin::NextRelease>. |
|
113
|
|
|
|
|
|
|
#pod |
|
114
|
|
|
|
|
|
|
#pod Dist::Zilla roles: |
|
115
|
|
|
|
|
|
|
#pod L<VersionProvider|Dist::Zilla::Role::VersionProvider>, |
|
116
|
|
|
|
|
|
|
#pod L<TextTemplate|Dist::Zilla::Role::TextTemplate>. |
|
117
|
|
|
|
|
|
|
#pod |
|
118
|
|
|
|
|
|
|
#pod =cut |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=encoding UTF-8 |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 NAME |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Dist::Zilla::Plugin::AutoVersion - take care of numbering versions so you don't have to |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 VERSION |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
version 6.030 |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This plugin automatically produces a version string, generally based on the |
|
137
|
|
|
|
|
|
|
current time. By default, it will be in the format: 1.yyDDDn |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 PERL VERSION |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
|
142
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
|
143
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
|
144
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
|
147
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
|
148
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
|
149
|
|
|
|
|
|
|
the minimum required perl. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 major |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The C<major> attribute is just an integer that is meant to store the major |
|
156
|
|
|
|
|
|
|
version number. If no value is specified in configuration, it will default to |
|
157
|
|
|
|
|
|
|
1. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This attribute's value can be referred to in the autoversion format template. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 format |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The format is a L<Text::Template> string that will be rendered to form the |
|
164
|
|
|
|
|
|
|
version. It is meant to access to one variable, C<$major>, and one subroutine, |
|
165
|
|
|
|
|
|
|
C<cldr>, which will format the current time (in GMT) using CLDR patterns (for |
|
166
|
|
|
|
|
|
|
which consult the L<DateTime> documentation). |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
The default value is: |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
{{ $major }}.{{ cldr('yyDDD') }} |
|
171
|
|
|
|
|
|
|
{{ sprintf('%01u', ($ENV{N} || 0)) }} |
|
172
|
|
|
|
|
|
|
{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Core Dist::Zilla plugins: |
|
177
|
|
|
|
|
|
|
L<PkgVersion|Dist::Zilla::Plugin::PkgVersion>, |
|
178
|
|
|
|
|
|
|
L<PodVersion|Dist::Zilla::Plugin::PodVersion>, |
|
179
|
|
|
|
|
|
|
L<NextRelease|Dist::Zilla::Plugin::NextRelease>. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Dist::Zilla roles: |
|
182
|
|
|
|
|
|
|
L<VersionProvider|Dist::Zilla::Role::VersionProvider>, |
|
183
|
|
|
|
|
|
|
L<TextTemplate|Dist::Zilla::Role::TextTemplate>. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 AUTHOR |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This software is copyright (c) 2023 by Ricardo SIGNES. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
194
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |