line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ukigumo::Client::CommandRunner; |
2
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
119
|
|
3
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
86
|
|
4
|
4
|
|
|
4
|
|
20
|
use Ukigumo::Constants; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
223
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
3765
|
use Mouse; |
|
4
|
|
|
|
|
143472
|
|
|
4
|
|
|
|
|
24
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has c => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
isa => 'Ukigumo::Client', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has config => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Ukigumo::Client::YamlConfig', |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
|
1649
|
no Mouse; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
24
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub run { |
23
|
8
|
|
|
8
|
0
|
5281
|
my ($self, $phase) = @_; |
24
|
8
|
|
|
|
|
50
|
my $c = $self->c; |
25
|
8
|
|
|
|
|
47
|
my $logger = $c->logger; |
26
|
|
|
|
|
|
|
|
27
|
8
|
|
|
|
|
17
|
my $extra_command; |
28
|
8
|
100
|
|
|
|
36
|
if ($phase eq 'install') { |
29
|
2
|
|
|
|
|
22
|
$extra_command = $self->_decide_install_cmd(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
8
|
50
|
66
|
|
|
20
|
for my $cmd (@{$extra_command || $self->config->$phase || []}) { |
|
8
|
|
|
|
|
194
|
|
33
|
8
|
|
|
|
|
108
|
$logger->infof("[${phase}] $cmd"); |
34
|
8
|
|
|
|
|
22
|
my $begin_time = time; |
35
|
|
|
|
|
|
|
|
36
|
8
|
100
|
|
|
|
84403
|
unless (system($cmd) == 0) { |
37
|
4
|
|
|
|
|
421
|
$logger->warnf("Failure in ${phase}: $cmd"); |
38
|
4
|
|
|
|
|
107
|
$c->reflect_result(STATUS_FAIL); |
39
|
4
|
|
|
|
|
163
|
die "Failure in ${phase}: $cmd\n"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
284
|
$c->elapsed_time_sec($c->elapsed_time_sec + time - $begin_time); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
246
|
return 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _decide_install_cmd { |
49
|
2
|
|
|
2
|
|
6
|
my ($self) = @_; |
50
|
|
|
|
|
|
|
|
51
|
2
|
50
|
|
|
|
71
|
if (my $install = $self->config->install) { |
52
|
2
|
50
|
|
|
|
21
|
return ref $install ? $install : [$install]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
0
|
|
|
|
if (-f 'Makefile.PL' || -f 'cpanfile' || -f 'Build.PL') { |
|
|
|
0
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return ['cpanm --notest --installdeps .']; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |