line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::New::Command::Version;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
18
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
4
|
use Carp;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
6
|
1
|
|
|
1
|
|
5
|
use Module::New::Meta;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
61
|
use Module::New::Queue;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
8
|
1
|
|
|
1
|
|
6
|
use Path::Tiny;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
9
|
1
|
|
|
1
|
|
569
|
use version;
|
|
1
|
|
|
|
|
1739
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
569
|
use Version::Next;
|
|
1
|
|
|
|
|
1234
|
|
|
1
|
|
|
|
|
7
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
functions {
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
update_versions => sub () { Module::New::Queue->register(sub {
|
15
|
0
|
|
|
0
|
|
|
my ($self, $version) = @_;
|
16
|
0
|
|
|
|
|
|
my $context = Module::New->context;
|
17
|
0
|
|
|
|
|
|
my $root = $context->path->_root;
|
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
require Parse::LocalDistribution;
|
20
|
0
|
|
|
|
|
|
my $parser = Parse::LocalDistribution->new({ALLOW_DEV_VERSION => 1});
|
21
|
0
|
|
|
|
|
|
my $info = $parser->parse($root);
|
22
|
0
|
|
|
|
|
|
my @versions = map {$_->[1]}
|
|
0
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
sort {$b->[0] <=> $a->[0]}
|
24
|
0
|
|
|
|
|
|
map {[version->parse($info->{$_}{version}), $info->{$_}{version}]}
|
25
|
0
|
|
|
|
|
|
grep {defined $info->{$_}{version}}
|
26
|
|
|
|
|
|
|
keys %$info;
|
27
|
0
|
|
0
|
|
|
|
$version ||= Version::Next::next_version($versions[0]);
|
28
|
0
|
0
|
|
|
|
|
croak "version $version is equal to or older than $versions[0]" if version->parse($version) <= version->parse($versions[0]);
|
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
for my $package (keys %$info) {
|
31
|
0
|
|
|
|
|
|
my $old_version = $info->{$package}{version};
|
32
|
0
|
0
|
0
|
|
|
|
next unless defined $old_version && $old_version ne 'undef';
|
33
|
0
|
0
|
|
|
|
|
my $file = $info->{$package}{infile} or next;
|
34
|
0
|
|
|
|
|
|
my $content = path($file)->slurp;
|
35
|
0
|
|
|
|
|
|
$content =~ s|(VERSION\s*=\s*["'])$old_version(["'])|$1$version$2|;
|
36
|
0
|
|
|
|
|
|
path($file)->spew($content);
|
37
|
0
|
|
|
|
|
|
$context->log( info => "updated $file" );
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$context->log( info => "updated VERSION(s) to $version" );
|
41
|
0
|
|
|
0
|
|
|
})},
|
42
|
|
|
|
|
|
|
};
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1;
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__
|