line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::SKIRMESS::InsertVersion; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1353
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.030'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
361
|
use Moose; |
|
1
|
|
|
|
|
360898
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with qw( |
12
|
|
|
|
|
|
|
Dist::Zilla::Role::FileMunger |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
6792
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
16
|
1
|
|
|
1
|
|
645
|
use Path::Tiny; |
|
1
|
|
|
|
|
7675
|
|
|
1
|
|
|
|
|
46
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
263
|
use namespace::autoclean; |
|
1
|
|
|
|
|
5424
|
|
|
1
|
|
|
|
|
3
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub munge_file { |
21
|
0
|
|
|
0
|
0
|
|
my ( $self, $file ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $filename = $file->name; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# stringify returns the path standardized with Unix-style / directory |
26
|
|
|
|
|
|
|
# separators. |
27
|
0
|
0
|
|
|
|
|
return if path($filename)->stringify() !~ m{ ^ (?: bin | lib | xt | t ) / }xsm; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $content = $file->content; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Skip files without pod |
32
|
0
|
0
|
|
|
|
|
return if $content !~ m{ ^ =pod }xsm; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if ( $content !~ m{ ^ =head1 \s+ VERSION $ }xsm ) { |
35
|
0
|
|
|
|
|
|
$self->log("No VERSION section found in POD in file $filename. Skipping it."); |
36
|
0
|
|
|
|
|
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Replace the existing VERSION section with the current version |
40
|
0
|
|
|
|
|
|
my $version_section = "\n\n=head1 VERSION\n\nVersion " . $self->zilla->version . "\n\n"; |
41
|
0
|
0
|
|
|
|
|
if ( |
42
|
|
|
|
|
|
|
$content !~ s{ |
43
|
|
|
|
|
|
|
[\s\n]* |
44
|
|
|
|
|
|
|
^ =head1 \s+ VERSION [^\n]* $ |
45
|
|
|
|
|
|
|
.*? |
46
|
|
|
|
|
|
|
^ ( = (?: head | cut ) ) |
47
|
|
|
|
|
|
|
}{$version_section$1}xsm |
48
|
|
|
|
|
|
|
) |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
|
|
|
$self->log_fatal("Unable to replace VERSION section in file $filename."); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# log_fatal should die |
53
|
0
|
|
|
|
|
|
croak 'internal error'; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$file->content($content); |
57
|
0
|
|
|
|
|
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: syntax=perl |