line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
166809
|
use 5.008001; |
|
6
|
|
|
|
|
16
|
|
2
|
6
|
|
|
6
|
|
23
|
use strict; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
106
|
|
3
|
6
|
|
|
6
|
|
16
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
291
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::BumpVersionAfterRelease::_Util; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.015'; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
21
|
use Moose::Role; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
37
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires 'allow_decimal_underscore'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# version regexes from version.pm |
14
|
|
|
|
|
|
|
my $FRACTION_PART = qr/\.[0-9]+/; |
15
|
|
|
|
|
|
|
my $STRICT_INTEGER_PART = qr/0|[1-9][0-9]*/; |
16
|
|
|
|
|
|
|
my $LAX_INTEGER_PART = qr/[0-9]+/; |
17
|
|
|
|
|
|
|
my $STRICT_DOTTED_DECIMAL_PART = qr/\.[0-9]{1,3}/; |
18
|
|
|
|
|
|
|
my $LAX_DOTTED_DECIMAL_PART = qr/\.[0-9]+/; |
19
|
|
|
|
|
|
|
my $LAX_ALPHA_PART = qr/_[0-9]+/; |
20
|
|
|
|
|
|
|
my $STRICT_DECIMAL_VERSION = qr/ $STRICT_INTEGER_PART $FRACTION_PART? /x; |
21
|
|
|
|
|
|
|
my $STRICT_DOTTED_DECIMAL_VERSION = |
22
|
|
|
|
|
|
|
qr/ v $STRICT_INTEGER_PART $STRICT_DOTTED_DECIMAL_PART{2,} /x; |
23
|
|
|
|
|
|
|
my $STRICT = qr/ $STRICT_DECIMAL_VERSION | $STRICT_DOTTED_DECIMAL_VERSION /x; |
24
|
|
|
|
|
|
|
my $LAX_DECIMAL_VERSION = |
25
|
|
|
|
|
|
|
qr/ $LAX_INTEGER_PART (?: \. | $FRACTION_PART $LAX_ALPHA_PART? )? |
26
|
|
|
|
|
|
|
| |
27
|
|
|
|
|
|
|
$FRACTION_PART $LAX_ALPHA_PART? |
28
|
|
|
|
|
|
|
/x; |
29
|
|
|
|
|
|
|
my $LAX_DOTTED_DECIMAL_VERSION = qr/ |
30
|
|
|
|
|
|
|
v $LAX_INTEGER_PART (?: $LAX_DOTTED_DECIMAL_PART+ $LAX_ALPHA_PART? )? |
31
|
|
|
|
|
|
|
| |
32
|
|
|
|
|
|
|
$LAX_INTEGER_PART? $LAX_DOTTED_DECIMAL_PART{2,} $LAX_ALPHA_PART? |
33
|
|
|
|
|
|
|
/x; |
34
|
|
|
|
|
|
|
|
35
|
34
|
50
|
|
34
|
0
|
715
|
sub is_strict_version { defined $_[0] && $_[0] =~ qr/\A $STRICT \z /x } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub is_loose_version { |
38
|
4
|
50
|
|
4
|
0
|
141
|
defined $_[0] && $_[0] =~ qr/\A (?: $STRICT | $LAX_DECIMAL_VERSION ) \z /x; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub is_tuple_alpha { |
42
|
39
|
|
|
39
|
0
|
49
|
my $v = shift; |
43
|
39
|
50
|
|
|
|
95
|
return unless defined $v; |
44
|
39
|
100
|
|
|
|
385
|
return unless $v =~ $LAX_DOTTED_DECIMAL_VERSION; |
45
|
1
|
|
|
|
|
37
|
return $v =~ m{$LAX_ALPHA_PART\z}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Because this is used for *capturing* or *replacing*, we take anything |
49
|
|
|
|
|
|
|
# that is a lax version (but not literal string 'undef', so we don't want |
50
|
|
|
|
|
|
|
# version::LAX). Later anything captured needs to be checked with the |
51
|
|
|
|
|
|
|
# strict or loose version check functions. |
52
|
|
|
|
|
|
|
sub assign_re { |
53
|
54
|
|
|
54
|
0
|
729
|
return qr{ |
54
|
|
|
|
|
|
|
our \s+ \$VERSION \s* = \s* |
55
|
|
|
|
|
|
|
(['"])($LAX_DECIMAL_VERSION | $LAX_DOTTED_DECIMAL_VERSION)\1 \s* ; |
56
|
|
|
|
|
|
|
(?:\s* \# \s TRIAL)? [^\n]* |
57
|
|
|
|
|
|
|
(?:\n \$VERSION \s = \s eval \s \$VERSION;)? |
58
|
|
|
|
|
|
|
}x; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub check_valid_version { |
62
|
39
|
|
|
39
|
0
|
64
|
my ( $self, $version ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
39
|
100
|
|
|
|
115
|
$self->log_fatal("version tuples with alpha elements are not supported") |
65
|
|
|
|
|
|
|
if is_tuple_alpha($version); |
66
|
|
|
|
|
|
|
|
67
|
38
|
100
|
|
|
|
1370
|
$self->log_fatal( |
|
|
100
|
|
|
|
|
|
68
|
|
|
|
|
|
|
"$version is not an allowed version string (maybe you need 'allow_decimal_underscore')" |
69
|
|
|
|
|
|
|
) |
70
|
|
|
|
|
|
|
unless $self->allow_decimal_underscore |
71
|
|
|
|
|
|
|
? is_loose_version($version) |
72
|
|
|
|
|
|
|
: is_strict_version($version); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=for Pod::Coverage is_strict_version is_loose_version assign_re is_tuple_alpha check_valid_version |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# vim: set ts=4 sts=4 sw=4 et tw=75: |