line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
61100
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
2
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
83
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::Deployment; |
5
|
|
|
|
|
|
|
$Footprintless::Deployment::VERSION = '1.26'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A deployment manager |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::Deployment |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use parent qw(Footprintless::MixableBase); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
76
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
103
|
|
12
|
2
|
|
|
|
|
83
|
use File::Path qw( |
13
|
|
|
|
|
|
|
make_path |
14
|
2
|
|
|
2
|
|
11
|
); |
|
2
|
|
|
|
|
3
|
|
15
|
2
|
|
|
|
|
129
|
use Footprintless::Mixins qw ( |
16
|
|
|
|
|
|
|
_clean |
17
|
|
|
|
|
|
|
_download |
18
|
|
|
|
|
|
|
_extract_resource |
19
|
|
|
|
|
|
|
_resource |
20
|
|
|
|
|
|
|
_sub_entity |
21
|
2
|
|
|
2
|
|
515
|
); |
|
2
|
|
|
|
|
5
|
|
22
|
2
|
|
|
|
|
76
|
use Footprintless::Util qw( |
23
|
|
|
|
|
|
|
agent |
24
|
|
|
|
|
|
|
rebase |
25
|
|
|
|
|
|
|
temp_dir |
26
|
2
|
|
|
2
|
|
13
|
); |
|
2
|
|
|
|
|
3
|
|
27
|
2
|
|
|
2
|
|
11
|
use Log::Any; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
6
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub clean { |
32
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @options ) = @_; |
33
|
2
|
|
|
|
|
9
|
$self->_clean(@options); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub deploy { |
37
|
7
|
|
|
7
|
1
|
84
|
my ( $self, %options ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
7
|
100
|
|
|
|
36
|
if ( $options{to_dir} ) { |
40
|
|
|
|
|
|
|
$self->_deploy_resources( $options{to_dir}, |
41
|
1
|
50
|
|
|
|
10
|
( $options{names} ? ( names => $options{names} ) : () ) ); |
42
|
1
|
50
|
|
|
|
9
|
&{ $options{extra} }( $options{to_dir} ) if ( $options{extra} ); |
|
0
|
|
|
|
|
0
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
|
|
|
|
|
|
$self->_local_template( |
46
|
|
|
|
|
|
|
sub { |
47
|
6
|
|
|
6
|
|
32
|
my ( $to_dir, $resource_dir ) = @_; |
48
|
|
|
|
|
|
|
$self->_deploy_resources( $resource_dir, |
49
|
6
|
50
|
|
|
|
51
|
( $options{names} ? ( names => $options{names} ) : () ) ); |
50
|
6
|
50
|
|
|
|
426
|
&{ $options{extra} }($to_dir) if ( $options{extra} ); |
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
rebase => $options{rebase} |
53
|
6
|
|
|
|
|
62
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
7
|
|
|
|
|
130
|
$logger->debug("deploy complete"); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _deploy_resources { |
60
|
7
|
|
|
7
|
|
26
|
my ( $self, $to_dir, %options ) = @_; |
61
|
7
|
|
|
|
|
29
|
my $resources = $self->_sub_entity( 'resources', 1 ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @names = |
64
|
|
|
|
|
|
|
$options{names} |
65
|
7
|
50
|
|
|
|
44
|
? @{ $options{names} } |
|
0
|
|
|
|
|
0
|
|
66
|
|
|
|
|
|
|
: keys(%$resources); |
67
|
|
|
|
|
|
|
|
68
|
7
|
|
|
|
|
44
|
$logger->debugf( "deploy %s to %s", \@names, $to_dir ); |
69
|
7
|
|
|
|
|
109
|
foreach my $resource_name (@names) { |
70
|
13
|
|
|
|
|
48
|
my $resource = $resources->{$resource_name}; |
71
|
13
|
100
|
100
|
|
|
110
|
if ( ref($resource) eq 'HASH' && $resource->{extract_to} ) { |
72
|
1
|
|
|
|
|
16
|
my $extract_dir = File::Spec->catdir( $to_dir, $resource->{extract_to} ); |
73
|
1
|
|
|
|
|
9
|
$logger->tracef( 'extract [%s] to [%s]', $resource, $to_dir ); |
74
|
1
|
|
|
|
|
13
|
$self->_extract_resource( $resource, $extract_dir ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else { |
77
|
12
|
|
|
|
|
92
|
$logger->tracef( 'download [%s] to [%s]', $resource, $to_dir ); |
78
|
12
|
|
|
|
|
217
|
$self->_download( $resource, $to_dir ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _local_template { |
84
|
6
|
|
|
6
|
|
49
|
my ( $self, $local_work, @options ) = @_; |
85
|
|
|
|
|
|
|
$self->Footprintless::Mixins::_local_template( |
86
|
|
|
|
|
|
|
sub { |
87
|
6
|
|
|
6
|
|
18
|
my ($to_dir) = @_; |
88
|
|
|
|
|
|
|
|
89
|
6
|
|
|
|
|
24
|
my $resource_dir = $self->_sub_entity('resource_dir'); |
90
|
6
|
100
|
|
|
|
29
|
$resource_dir = |
91
|
|
|
|
|
|
|
$resource_dir |
92
|
|
|
|
|
|
|
? File::Spec->catdir( $to_dir, $resource_dir ) |
93
|
|
|
|
|
|
|
: $to_dir; |
94
|
6
|
|
|
|
|
552
|
make_path($resource_dir); |
95
|
|
|
|
|
|
|
|
96
|
6
|
|
|
|
|
32
|
&$local_work( $to_dir, $resource_dir ); |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
@options |
99
|
6
|
|
|
|
|
82
|
); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |