line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Determine the version of a system under test via the module's Changes file for upload to elasticsearch |
2
|
|
|
|
|
|
|
# PODNAME: App::Prove::Elasticsearch::Versioner::Default |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::Prove::Elasticsearch::Versioner::Default; |
5
|
|
|
|
|
|
|
$App::Prove::Elasticsearch::Versioner::Default::VERSION = '0.001'; |
6
|
2
|
|
|
2
|
|
97858
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
43
|
|
7
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
42
|
|
8
|
2
|
|
|
2
|
|
438
|
use utf8; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
56
|
use File::Basename qw{dirname}; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
129
|
|
11
|
2
|
|
|
2
|
|
9
|
use Cwd qw{abs_path}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
375
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $version = {}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_version { |
16
|
4
|
|
|
4
|
1
|
3050
|
my $loc = abs_path(dirname(shift) . "/../Changes"); |
17
|
|
|
|
|
|
|
|
18
|
4
|
100
|
|
|
|
55
|
return $version->{$loc} if $version->{$loc}; |
19
|
3
|
|
|
|
|
7
|
my $ret; |
20
|
3
|
100
|
|
|
|
100
|
open(my $fh, '<', $loc) or die "Could not open Changes in $loc"; |
21
|
2
|
|
|
|
|
28
|
while (<$fh>) { |
22
|
1
|
|
|
|
|
5
|
($ret) = $_ =~ m/(^\S*)/; |
23
|
1
|
50
|
|
|
|
4
|
last if $ret; |
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
|
|
17
|
close $fh; |
26
|
2
|
100
|
|
|
|
15
|
die 'Could not determine the latest version from Changes!' unless $ret; |
27
|
1
|
|
|
|
|
3
|
$version->{$loc} = $ret; |
28
|
1
|
|
|
|
|
8
|
return $ret; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
*get_file_version = \&get_version; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |