line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Boxer::Task::Serialize; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding UTF-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=cut |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
3055
|
use v5.20; |
|
3
|
|
|
|
|
11
|
|
8
|
3
|
|
|
3
|
|
17
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
9
|
3
|
|
|
3
|
|
91
|
use Role::Commons -all; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
22
|
|
10
|
3
|
|
|
3
|
|
5663
|
use feature 'signatures'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
335
|
|
11
|
3
|
|
|
3
|
|
22
|
use namespace::autoclean 0.16; |
|
3
|
|
|
|
|
55
|
|
|
3
|
|
|
|
|
21
|
|
12
|
3
|
|
|
3
|
|
215
|
use autodie; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
25
|
|
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
15324
|
use Path::Tiny; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
233
|
|
15
|
3
|
|
|
3
|
|
1691
|
use File::ShareDir qw(dist_dir); |
|
3
|
|
|
|
|
37401
|
|
|
3
|
|
|
|
|
165
|
|
16
|
3
|
|
|
3
|
|
1426
|
use Boxer::File::WithSkeleton; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
98
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
21
|
use Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
12
|
|
19
|
3
|
|
|
3
|
|
1328
|
use MooX::StrictConstructor; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
20
|
|
|
|
|
|
|
extends qw(Boxer::Task); |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
2379
|
use Types::Standard qw( Bool Maybe Str Undef InstanceOf ); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
23
|
|
23
|
3
|
|
|
3
|
|
3411
|
use Types::Path::Tiny qw( Dir File Path ); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
13
|
|
24
|
3
|
|
|
3
|
|
1845
|
use Boxer::Types qw( SkelDir SerializationList ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
11
|
|
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
3
|
|
1437
|
use strictures 2; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
106
|
|
27
|
3
|
|
|
3
|
|
486
|
no warnings "experimental::signatures"; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1547
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Version v1.4.2 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = "v1.4.2"; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has world => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
isa => InstanceOf ['Boxer::World'], |
40
|
|
|
|
|
|
|
required => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has skeldir => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => Maybe [SkelDir], |
46
|
|
|
|
|
|
|
coerce => 1, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has infile => ( |
50
|
|
|
|
|
|
|
is => 'ro', |
51
|
|
|
|
|
|
|
isa => File, |
52
|
|
|
|
|
|
|
coerce => 1, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has altinfile => ( |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => File, |
58
|
|
|
|
|
|
|
coerce => 1, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has outdir => ( |
62
|
|
|
|
|
|
|
is => 'ro', |
63
|
|
|
|
|
|
|
isa => Dir, |
64
|
|
|
|
|
|
|
coerce => 1, |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has outfile => ( |
68
|
|
|
|
|
|
|
is => 'ro', |
69
|
|
|
|
|
|
|
isa => Path, |
70
|
|
|
|
|
|
|
coerce => 1, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has altoutfile => ( |
74
|
|
|
|
|
|
|
is => 'ro', |
75
|
|
|
|
|
|
|
isa => Path, |
76
|
|
|
|
|
|
|
coerce => 1, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has node => ( |
80
|
|
|
|
|
|
|
is => 'ro', |
81
|
|
|
|
|
|
|
isa => Str, |
82
|
|
|
|
|
|
|
required => 1, |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
has format => ( |
86
|
|
|
|
|
|
|
is => 'ro', |
87
|
|
|
|
|
|
|
isa => SerializationList, |
88
|
|
|
|
|
|
|
coerce => 1, |
89
|
|
|
|
|
|
|
required => 1, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has nonfree => ( |
93
|
|
|
|
|
|
|
is => 'ro', |
94
|
|
|
|
|
|
|
isa => Bool, |
95
|
|
|
|
|
|
|
required => 1, |
96
|
|
|
|
|
|
|
default => sub {0}, |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub run ($self) |
100
|
6
|
|
|
6
|
0
|
1955
|
{ |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
11
|
|
101
|
6
|
|
|
|
|
51
|
my $world = $self->world->map( $self->node, $self->nonfree, ); |
102
|
|
|
|
|
|
|
|
103
|
6
|
100
|
|
|
|
835
|
if ( grep( /^preseed$/, @{ $self->format } ) ) { |
|
6
|
|
|
|
|
53
|
|
104
|
4
|
|
|
|
|
44
|
my @args = ( |
105
|
|
|
|
|
|
|
basename => 'preseed.cfg', |
106
|
|
|
|
|
|
|
skeleton_dir => $self->skeldir, |
107
|
|
|
|
|
|
|
skeleton_path => $self->infile, |
108
|
|
|
|
|
|
|
file_dir => $self->outdir, |
109
|
|
|
|
|
|
|
file_path => $self->outfile, |
110
|
|
|
|
|
|
|
); |
111
|
4
|
50
|
|
|
|
94
|
$self->_logger->info( |
112
|
|
|
|
|
|
|
'Serializing to preseed', |
113
|
|
|
|
|
|
|
$self->_logger->is_debug() ? {@args} : (), |
114
|
|
|
|
|
|
|
); |
115
|
4
|
|
|
|
|
2056
|
my $file = Boxer::File::WithSkeleton->new(@args); |
116
|
4
|
|
|
|
|
300
|
$world->as_file($file); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
6
|
100
|
|
|
|
13
|
if ( grep( /^script$/, @{ $self->format } ) ) { |
|
6
|
|
|
|
|
54
|
|
120
|
4
|
|
|
|
|
74
|
my @args = ( |
121
|
|
|
|
|
|
|
basename => 'script.sh', |
122
|
|
|
|
|
|
|
skeleton_dir => $self->skeldir, |
123
|
|
|
|
|
|
|
skeleton_path => $self->altinfile, |
124
|
|
|
|
|
|
|
file_dir => $self->outdir, |
125
|
|
|
|
|
|
|
file_path => $self->altoutfile, |
126
|
|
|
|
|
|
|
); |
127
|
4
|
50
|
|
|
|
94
|
$self->_logger->info( |
128
|
|
|
|
|
|
|
'Serializing to script', |
129
|
|
|
|
|
|
|
$self->_logger->is_debug() ? {@args} : (), |
130
|
|
|
|
|
|
|
); |
131
|
4
|
|
|
|
|
1494
|
my $file = Boxer::File::WithSkeleton->new(@args); |
132
|
4
|
|
|
|
|
309
|
$world->as_file( $file, 1 ); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
6
|
|
|
|
|
303
|
1; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Jonas Smedegaard C<< <dr@jones.dk> >>. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Copyright © 2013-2016 Jonas Smedegaard |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
151
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
156
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
157
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; |