line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Boxer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding UTF-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Boxer - system deployment ninja tricks |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
4315
|
use v5.20; |
|
5
|
|
|
|
|
15
|
|
12
|
5
|
|
|
5
|
|
22
|
use utf8; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
41
|
|
13
|
5
|
|
|
5
|
|
875
|
use Role::Commons -all; |
|
5
|
|
|
|
|
42931
|
|
|
5
|
|
|
|
|
35
|
|
14
|
5
|
|
|
5
|
|
54047
|
use feature 'signatures'; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
477
|
|
15
|
5
|
|
|
5
|
|
890
|
use namespace::autoclean 0.16; |
|
5
|
|
|
|
|
16869
|
|
|
5
|
|
|
|
|
28
|
|
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
|
2300
|
use Module::Find; |
|
5
|
|
|
|
|
6229
|
|
|
5
|
|
|
|
|
310
|
|
18
|
5
|
|
|
5
|
|
2766
|
use Module::Load::Conditional qw(can_load); |
|
5
|
|
|
|
|
110070
|
|
|
5
|
|
|
|
|
395
|
|
19
|
5
|
|
|
5
|
|
501
|
use Log::Any qw($log); |
|
5
|
|
|
|
|
7526
|
|
|
5
|
|
|
|
|
59
|
|
20
|
|
|
|
|
|
|
|
21
|
5
|
|
|
5
|
|
2830
|
use strictures 2; |
|
5
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
197
|
|
22
|
5
|
|
|
5
|
|
924
|
no warnings "experimental::signatures"; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1544
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 VERSION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Version v1.4.3 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = "v1.4.3"; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use Boxer; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $domain = Boxer->get_world('Reclass')->new( suite => 'stretch', data => 'examples' ); |
37
|
|
|
|
|
|
|
say $domain->list_parts(); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $goal = $domain->get_part('lxp5'); |
40
|
|
|
|
|
|
|
my $plan = $domain->map( $goal, 1 ); |
41
|
|
|
|
|
|
|
$plan->as_file( Boxer::File::WithSkeleton->new( basename => 'preseed.cfg' ) ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $serializer = Boxer::File::WithSkeleton->new( skeleton => 'script.sh.in' ); |
44
|
|
|
|
|
|
|
$plan->as_file( $serializer->file( 'script.sh', 1 ) ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $anothergoal = $domain->get_part('parl-greens'); |
47
|
|
|
|
|
|
|
my $anotherplan = $domain->map($anothergoal); |
48
|
|
|
|
|
|
|
$anotherplan->as_file( $serializer->file( 'parl-greens.sh', 1 ) ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $newdomain = Boxer->get_world()->new( suite => 'buster', data => 'examples' ); |
51
|
|
|
|
|
|
|
my $plan_a = $newdomain->map($goal); |
52
|
|
|
|
|
|
|
$plan_a->as_file( Boxer::File::WithSkeleton->new( basename => 'preseed_pure.cfg' ) ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Framework for system deployment ninja tricks. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
See L for further information. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub list_worlds ($self) |
63
|
11
|
|
|
11
|
0
|
1318
|
{ |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
25
|
|
64
|
11
|
|
|
|
|
38
|
return findsubmod Boxer::World; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_world |
68
|
|
|
|
|
|
|
{ |
69
|
10
|
|
|
10
|
0
|
16080
|
my ( $self, $name ) = @_; |
70
|
|
|
|
|
|
|
|
71
|
10
|
|
100
|
|
|
33
|
$name ||= 'flat'; |
72
|
|
|
|
|
|
|
|
73
|
10
|
|
|
|
|
32
|
foreach my $world ( $self->list_worlds() ) { |
74
|
14
|
100
|
|
|
|
14323
|
if ( lc( substr( $world, -( length($name) + 2 ) ) ) eq lc("::$name") ) |
75
|
|
|
|
|
|
|
{ |
76
|
9
|
50
|
|
|
|
51
|
unless ( can_load( modules => { $world => 0 } ) ) { |
77
|
0
|
|
|
|
|
0
|
$log->error($Module::Load::Conditional::ERROR); |
78
|
0
|
|
|
|
|
0
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
9
|
|
|
|
|
5515
|
return $world; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
1
|
|
|
|
|
19
|
$log->error("No world \"$name\" found"); |
84
|
1
|
|
|
|
|
65
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 BUGS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report any bugs to |
90
|
|
|
|
|
|
|
L. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SEE ALSO |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L, |
95
|
|
|
|
|
|
|
L, |
96
|
|
|
|
|
|
|
L, |
97
|
|
|
|
|
|
|
L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
L |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L, |
114
|
|
|
|
|
|
|
L, |
115
|
|
|
|
|
|
|
L, |
116
|
|
|
|
|
|
|
L, |
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Jonas Smedegaard C<< >>. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright © 2013-2016 Jonas Smedegaard |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
132
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
137
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
138
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |