line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Prove::Elasticsearch::Provisioner::Git; |
2
|
|
|
|
|
|
|
$App::Prove::Elasticsearch::Provisioner::Git::VERSION = '0.001'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# PODNAME: App::Prove::Elasticsearch::Provisioner::Git; |
5
|
|
|
|
|
|
|
# ABSTRACT: Provision new versions to test using git |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
95940
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
46
|
|
8
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
43
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1127
|
use App::perlbrew; |
|
2
|
|
|
|
|
65760
|
|
|
2
|
|
|
|
|
76
|
|
11
|
2
|
|
|
2
|
|
970
|
use Perl::Version; |
|
2
|
|
|
|
|
4162
|
|
|
2
|
|
|
|
|
53
|
|
12
|
2
|
|
|
2
|
|
730
|
use Capture::Tiny qw{capture_stderr}; |
|
2
|
|
|
|
|
38649
|
|
|
2
|
|
|
|
|
139
|
|
13
|
2
|
|
|
2
|
|
1016
|
use Git; |
|
2
|
|
|
|
|
33332
|
|
|
2
|
|
|
|
|
430
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_available_provision_targets { |
16
|
1
|
|
|
1
|
1
|
1066
|
my ($cv) = @_; |
17
|
1
|
|
|
|
|
3
|
my @bs = Git::command(qw{rev-parse --abbrev-ref --all}); |
18
|
1
|
50
|
|
|
|
5
|
@bs = grep { $cv ne $_ } @bs if $cv; |
|
0
|
|
|
|
|
0
|
|
19
|
1
|
|
|
|
|
3
|
return @bs; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub pick_platform { |
23
|
1
|
|
|
1
|
1
|
1030
|
my (@plats) = @_; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
2
|
my $plat; |
26
|
1
|
|
|
|
|
3
|
foreach my $p (@plats) { |
27
|
1
|
|
|
|
|
4
|
my @cmd = (qw{git reflog show}, $p); |
28
|
1
|
|
|
|
|
1
|
my $ref_exists; |
29
|
1
|
|
|
1
|
|
23
|
capture_stderr { $ref_exists = Git::command(@cmd) }; |
|
1
|
|
|
|
|
838
|
|
30
|
1
|
50
|
|
|
|
331
|
if ($ref_exists) { |
31
|
1
|
|
|
|
|
3
|
$plat = $p; |
32
|
1
|
|
|
|
|
11
|
@plats = grep { $_ ne $p } @plats; |
|
3
|
|
|
|
|
7
|
|
33
|
1
|
|
|
|
|
3
|
last; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
1
|
|
|
|
|
4
|
return $plat, \@plats; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub can_switch_version { |
40
|
2
|
|
|
2
|
1
|
2001
|
my $versioner = shift; |
41
|
2
|
|
|
|
|
10
|
return $versioner eq 'App::Prove::Elasticsearch::Versioner::Git'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub switch_version_to { |
45
|
2
|
|
|
2
|
1
|
5014
|
my $version_to = shift; |
46
|
2
|
|
|
|
|
6
|
return Git::command(qw{reset --hard}, $version_to); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
*provision = \&switch_version_to; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |