line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13845
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
15
|
use 5.010001; |
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.7032_1'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
492
|
use FindBin qw/$Script/; |
|
1
|
|
|
|
|
815
|
|
|
1
|
|
|
|
|
85
|
|
11
|
1
|
|
|
1
|
|
597
|
use Getopt::Long; |
|
1
|
|
|
|
|
9231
|
|
|
1
|
|
|
|
|
5
|
|
12
|
1
|
|
|
1
|
|
525
|
use Try::Lite; |
|
1
|
|
|
|
|
1050
|
|
|
1
|
|
|
|
|
1803
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
16
|
|
|
|
|
|
|
our @EXPORT = qw/ |
17
|
|
|
|
|
|
|
enbld |
18
|
|
|
|
|
|
|
build |
19
|
|
|
|
|
|
|
target |
20
|
|
|
|
|
|
|
define |
21
|
|
|
|
|
|
|
version |
22
|
|
|
|
|
|
|
make_test |
23
|
|
|
|
|
|
|
modules |
24
|
|
|
|
|
|
|
arguments |
25
|
|
|
|
|
|
|
annotation |
26
|
|
|
|
|
|
|
conf |
27
|
|
|
|
|
|
|
load |
28
|
|
|
|
|
|
|
copy |
29
|
|
|
|
|
|
|
set |
30
|
|
|
|
|
|
|
from |
31
|
|
|
|
|
|
|
to |
32
|
|
|
|
|
|
|
content |
33
|
|
|
|
|
|
|
/; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
require Enbld::App::Configuration; |
36
|
|
|
|
|
|
|
require Enbld::Logger; |
37
|
|
|
|
|
|
|
require Enbld::Target; |
38
|
|
|
|
|
|
|
require Enbld::Condition; |
39
|
|
|
|
|
|
|
require Enbld::Error; |
40
|
|
|
|
|
|
|
require Enbld::Exception; |
41
|
|
|
|
|
|
|
require Enbld::RcFile; |
42
|
|
|
|
|
|
|
require Enbld::Deployed; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $initialized; |
45
|
|
|
|
|
|
|
our %target_result; |
46
|
|
|
|
|
|
|
our %rcfile_result; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our %rcfile_collection; |
49
|
|
|
|
|
|
|
our %target_collection; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub enbld($$) { |
52
|
0
|
|
|
0
|
0
|
|
my ( $envname, $coderef ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ( ref( $envname ) ) { |
55
|
0
|
|
|
|
|
|
_err( |
56
|
|
|
|
|
|
|
"Function 'enbld' first requires " . |
57
|
|
|
|
|
|
|
"string type parameter 'env name'." |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if ( $envname =~ /[^0-9a-zA-Z_]/ ) { |
62
|
0
|
|
|
|
|
|
_err( |
63
|
|
|
|
|
|
|
"Env name '$envname' contains invalid character.", |
64
|
|
|
|
|
|
|
$envname |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if ( ref( $coderef ) ne 'CODE' ) { |
69
|
0
|
|
|
|
|
|
_err( "Function 'enbld' second requires code reference parameter." ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
require Enbld::Message; |
73
|
0
|
|
|
|
|
|
Enbld::Message->set_verbose; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
parse_option(); |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
require Enbld::Home; |
78
|
0
|
|
|
|
|
|
Enbld::Home->initialize; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
Enbld::App::Configuration->read_file; |
81
|
0
|
|
|
|
|
|
Enbld::App::Configuration->set_envname( $_[0] ); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$initialized++; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$_[1]->(); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
Enbld->_setup_directory; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
foreach my $name ( sort keys %target_collection ) { |
90
|
0
|
|
|
|
|
|
build_target( $name ); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
foreach my $filepath ( sort keys %rcfile_collection ) { |
94
|
0
|
|
|
|
|
|
do_rcfile( $rcfile_collection{$filepath} ); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
undef $initialized; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
show_result_message(); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
check_targets_in_DSL(); |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
if ( ! Enbld::App::Configuration->is_dirty ) { |
104
|
0
|
|
|
|
|
|
Enbld::Message->notify( |
105
|
|
|
|
|
|
|
"INFO:No builded targets & loaded configuration file." |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub build_target { |
113
|
0
|
|
|
0
|
0
|
|
my $name = shift; |
114
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
my $config = Enbld::Feature->is_deploy_mode ? undef : |
116
|
|
|
|
|
|
|
Enbld::App::Configuration->search_config( $name ); |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $target = Enbld::Target->new( $name, $config ); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $installed = try { |
121
|
0
|
0
|
|
0
|
|
|
return Enbld::Feature->is_deploy_mode ? |
122
|
|
|
|
|
|
|
$target->deploy_declared( \%target_collection ) : |
123
|
|
|
|
|
|
|
$target->install_declared( \%target_collection ); |
124
|
|
|
|
|
|
|
} ( 'Enbld::Error' => sub { |
125
|
0
|
|
|
0
|
|
|
Enbld::Message->alert( $@ ); |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if ( $^O ne 'darwin' ) { |
128
|
0
|
|
|
|
|
|
say "If you run Enbld at Linux or BSD, there is a possibility " . |
129
|
|
|
|
|
|
|
"that the Software which depends is not installed."; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
say "\n" . "Please check build logile:" . Enbld::Logger->logfile; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$target_result{$name} = $name . ' is failure to build.'; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
return; |
137
|
|
|
|
|
|
|
} |
138
|
0
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Target is installed. |
141
|
0
|
0
|
|
|
|
|
if ( $installed ) { |
142
|
0
|
|
|
|
|
|
$target_result{$name} = $name . ' ' . $installed->enabled . |
143
|
|
|
|
|
|
|
" is installed."; |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
Enbld::App::Configuration->set_config( $installed ); |
146
|
0
|
|
|
|
|
|
Enbld::App::Configuration->write_file; |
147
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
|
if ( Enbld::Feature->is_deploy_mode ) { |
149
|
0
|
|
|
|
|
|
Enbld::Deployed->add( $installed ); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
return $name; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# Target is up-to-date. |
156
|
0
|
|
|
|
|
|
$target_result{$name} = $name . ' is up-to-date.'; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return $name; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub check_targets_in_DSL { |
162
|
|
|
|
|
|
|
|
163
|
0
|
0
|
|
0
|
0
|
|
return if Enbld::Feature->is_deploy_mode; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
my %not_in_dsl; |
166
|
0
|
|
|
|
|
|
foreach my $name ( keys %{ Enbld::App::Configuration->config } ) { |
|
0
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
my $config = Enbld::App::Configuration->search_config( $name ); |
168
|
|
|
|
|
|
|
|
169
|
0
|
0
|
|
|
|
|
$not_in_dsl{$name}++ unless defined $target_result{$name}; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
|
if ( keys %not_in_dsl ) { |
173
|
0
|
|
|
|
|
|
Enbld::Message->notify( |
174
|
|
|
|
|
|
|
"WARN:The following targets are not defined in DSL $Script.\n" . |
175
|
|
|
|
|
|
|
"Please check $Script." |
176
|
|
|
|
|
|
|
); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
foreach my $target ( sort keys %not_in_dsl ) { |
179
|
0
|
|
|
|
|
|
Enbld::Message->notify( " " . $target ); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub show_result_message { |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
0
|
0
|
|
foreach my $target ( sort keys %target_result ) { |
187
|
0
|
|
|
|
|
|
Enbld::Message->notify( $target_result{$target} ); |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
foreach my $file ( sort keys %rcfile_result ) { |
191
|
0
|
|
|
|
|
|
Enbld::Message->notify( $rcfile_result{$file} ); |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub build(&) { |
196
|
0
|
|
|
0
|
0
|
|
return $_[0]; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
our $condition_ref; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub target($$) { |
202
|
0
|
|
|
0
|
1
|
|
my ( $targetname, $coderef ) = @_; |
203
|
|
|
|
|
|
|
|
204
|
0
|
0
|
|
|
|
|
if ( ! $initialized ) { |
205
|
0
|
|
|
|
|
|
_err( |
206
|
|
|
|
|
|
|
"Environment is not initialized.". |
207
|
|
|
|
|
|
|
"Isn't the syntax of DSL possibly mistaken?" |
208
|
|
|
|
|
|
|
); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
0
|
0
|
|
|
|
|
if ( ref( $targetname ) ) { |
212
|
0
|
|
|
|
|
|
_err( |
213
|
|
|
|
|
|
|
"Function 'target' first requsres " . |
214
|
|
|
|
|
|
|
"string type parameter 'target name'." |
215
|
|
|
|
|
|
|
); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
0
|
0
|
|
|
|
|
if( $targetname =~ /[^0-9a-z]/ ) { |
219
|
0
|
|
|
|
|
|
_err( "Target name '$targetname' contains invalid character." ); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
|
if ( ref( $coderef ) ne 'CODE' ) { |
223
|
0
|
|
|
|
|
|
_err( "Function 'target' seconde requires code reference parameter." ); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
$condition_ref = { |
227
|
0
|
|
|
|
|
|
name => $targetname, |
228
|
|
|
|
|
|
|
}; |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
$coderef->(); |
231
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
my $condition = Enbld::Condition->new( %{ $condition_ref } ); |
|
0
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
$target_collection{$targetname} = $condition; |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
undef $condition_ref; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub define(&) { |
239
|
0
|
|
|
0
|
0
|
|
my $coderef = shift; |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
return $coderef; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub version($) { |
245
|
0
|
|
|
0
|
1
|
|
my $version = shift; |
246
|
|
|
|
|
|
|
|
247
|
0
|
0
|
|
|
|
|
if ( ref( $version ) ) { |
248
|
0
|
|
|
|
|
|
_err( "Function 'version' requires string type parameter." ); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
$condition_ref->{version} = $version; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub make_test(;$) { |
255
|
0
|
|
|
0
|
0
|
|
my $make_test = shift; |
256
|
|
|
|
|
|
|
|
257
|
0
|
0
|
0
|
|
|
|
if ( $make_test && ref( $make_test ) ) { |
258
|
0
|
|
|
|
|
|
_err( "Function 'make_test' requires string type parameter." ); |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
0
|
0
|
|
|
|
|
$condition_ref->{make_test} = $make_test if $make_test; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub arguments($) { |
265
|
0
|
|
|
0
|
0
|
|
my $arguments = shift; |
266
|
|
|
|
|
|
|
|
267
|
0
|
0
|
|
|
|
|
if ( ref( $arguments ) ) { |
268
|
0
|
|
|
|
|
|
_err( "Function 'arguments' requires string type parameter." ); |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
0
|
|
|
|
|
|
$condition_ref->{arguments} = $arguments; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub annotation($) { |
275
|
0
|
|
|
0
|
0
|
|
my $annotation = shift; |
276
|
|
|
|
|
|
|
|
277
|
0
|
0
|
|
|
|
|
if ( ref( $annotation ) ) { |
278
|
0
|
|
|
|
|
|
_err( "Function 'annotation' requires string type parameter." ); |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
$condition_ref->{annotation} = $annotation; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub modules($) { |
285
|
0
|
|
|
0
|
0
|
|
my $modules = shift; |
286
|
|
|
|
|
|
|
|
287
|
0
|
0
|
|
|
|
|
if ( ref( $modules ) ne 'HASH' ) { |
288
|
0
|
|
|
|
|
|
_err( "Function 'modules' requires HASH reference type parameter." ); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
|
$condition_ref->{modules} = $modules; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
our $rcfile_condition; |
295
|
|
|
|
|
|
|
sub conf($$) { |
296
|
0
|
|
|
0
|
0
|
|
my ( $filepath, $coderef ) = @_; |
297
|
|
|
|
|
|
|
|
298
|
0
|
0
|
|
|
|
|
if ( ! $initialized ) { |
299
|
0
|
|
|
|
|
|
_err( |
300
|
|
|
|
|
|
|
"Environment is not initialized.". |
301
|
|
|
|
|
|
|
"Isn't the syntax of DSL possibly mistaken?" |
302
|
|
|
|
|
|
|
); |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
0
|
0
|
|
|
|
|
if ( ref( $filepath ) ) { |
306
|
0
|
|
|
|
|
|
_err( "Function 'conf' first requires string type parameter." ); |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
0
|
0
|
|
|
|
|
if ( $filepath =~ /\s/ ) { |
310
|
0
|
|
|
|
|
|
_err( |
311
|
|
|
|
|
|
|
"Configuration file path parameter must " . |
312
|
|
|
|
|
|
|
"not contain space character." |
313
|
|
|
|
|
|
|
); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
0
|
0
|
|
|
|
|
if ( ref( $coderef ) ne 'CODE' ) { |
317
|
0
|
|
|
|
|
|
_err( "Function 'conf' requires code reference type parameter." ); |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
|
$coderef->(); |
321
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
$rcfile_condition->{filepath} = $filepath; |
323
|
0
|
|
|
|
|
|
$rcfile_collection{$filepath} = Enbld::RcFile->new( %{ $rcfile_condition } ); |
|
0
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
undef $rcfile_condition; |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub do_rcfile { |
329
|
0
|
|
|
0
|
0
|
|
my $rcfile = shift; |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
my $result = try { |
332
|
0
|
|
|
0
|
|
|
return $rcfile->do; |
333
|
|
|
|
|
|
|
} ( 'Enbld::Error' => sub { |
334
|
0
|
|
|
0
|
|
|
Enbld::Message->alert( $@ ); |
335
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
say "\n" . "Please check build logile:" . Enbld::Logger->logfile; |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
$rcfile_result{$rcfile->filepath} = |
339
|
|
|
|
|
|
|
$rcfile->filepath . ' is failure to create.'; |
340
|
|
|
|
|
|
|
|
341
|
0
|
|
|
|
|
|
return; |
342
|
|
|
|
|
|
|
} |
343
|
0
|
|
|
|
|
|
); |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# Configuration file is loaded or set. |
346
|
0
|
0
|
|
|
|
|
if ( $result ) { |
347
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
|
Enbld::App::Configuration->set_rcfile( $rcfile ); |
349
|
0
|
|
|
|
|
|
Enbld::App::Configuration->write_file; |
350
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
$rcfile_result{$rcfile->filepath} = |
352
|
|
|
|
|
|
|
$rcfile->filepath . ' is created.'; |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
return $result; |
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
# Configuration file is not loaded or set. |
358
|
0
|
|
|
|
|
|
$rcfile_result{$rcfile->filepath} = |
359
|
|
|
|
|
|
|
$rcfile->filepath . ' is not created.'; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
return; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub load(&) { |
365
|
0
|
|
|
0
|
0
|
|
$rcfile_condition->{command} = 'load'; |
366
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
return $_[0]; |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub set(&) { |
371
|
0
|
|
|
0
|
0
|
|
$rcfile_condition->{command} = 'set'; |
372
|
|
|
|
|
|
|
|
373
|
0
|
|
|
|
|
|
return $_[0]; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub copy(&) { |
377
|
0
|
|
|
0
|
0
|
|
$rcfile_condition->{command} = 'copy'; |
378
|
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
|
return $_[0]; |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
sub from($) { |
383
|
0
|
|
|
0
|
1
|
|
my $from = shift; |
384
|
|
|
|
|
|
|
|
385
|
0
|
0
|
|
|
|
|
if ( ref( $from ) ) { |
386
|
0
|
|
|
|
|
|
_err( "Function 'from' requsres string type parameter." ); |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
|
$rcfile_condition->{from} = $from; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
sub to($) { |
393
|
0
|
|
|
0
|
1
|
|
my $to = shift; |
394
|
|
|
|
|
|
|
|
395
|
0
|
0
|
|
|
|
|
if ( ref( $to ) ) { |
396
|
0
|
|
|
|
|
|
_err( "Function 'to' requsres string type parameter." ); |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
0
|
0
|
|
|
|
|
if ( $to =~ /\s/ ) { |
400
|
0
|
|
|
|
|
|
_err( "Function 'to' must not contain space character." ); |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
|
403
|
0
|
|
|
|
|
|
$rcfile_condition->{directory} = $to; |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
sub content($) { |
407
|
0
|
|
|
0
|
0
|
|
my $content = shift; |
408
|
|
|
|
|
|
|
|
409
|
0
|
0
|
|
|
|
|
if ( ref( $content ) ) { |
410
|
0
|
|
|
|
|
|
_err( "Function 'content' reuqires string type parameter." ); |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
chomp( $content ); |
414
|
|
|
|
|
|
|
|
415
|
0
|
|
|
|
|
|
$rcfile_condition->{contents} .= $content . "\n"; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
our $setuped; |
419
|
|
|
|
|
|
|
sub _setup_directory { |
420
|
|
|
|
|
|
|
|
421
|
0
|
0
|
|
0
|
|
|
unless ( $setuped ) { |
422
|
0
|
|
|
|
|
|
Enbld::Home->create_build_directory; |
423
|
0
|
|
|
|
|
|
Enbld::Logger->rotate( Enbld::Home->log ); |
424
|
|
|
|
|
|
|
|
425
|
0
|
|
|
|
|
|
$setuped++; |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
sub parse_option { |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
0
|
0
|
|
my $make_test; |
432
|
|
|
|
|
|
|
my $force; |
433
|
0
|
|
|
|
|
|
my $deploy_path; |
434
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
|
Getopt::Long::Configure( "bundling" ); |
436
|
|
|
|
|
|
|
Getopt::Long::GetOptions( |
437
|
0
|
|
|
0
|
|
|
't|test' => sub { $make_test++ }, |
438
|
0
|
|
|
0
|
|
|
'f|force' => sub { $force++ }, |
439
|
0
|
|
|
|
|
|
'd|deploy=s' => \$deploy_path, |
440
|
|
|
|
|
|
|
); |
441
|
|
|
|
|
|
|
|
442
|
0
|
|
|
|
|
|
require Enbld::Feature; |
443
|
0
|
|
|
|
|
|
Enbld::Feature->initialize( |
444
|
|
|
|
|
|
|
make_test => $make_test, |
445
|
|
|
|
|
|
|
force => $force, |
446
|
|
|
|
|
|
|
deploy => $deploy_path, |
447
|
|
|
|
|
|
|
); |
448
|
|
|
|
|
|
|
|
449
|
0
|
0
|
|
|
|
|
if ( Enbld::Feature->is_deploy_mode ) { |
450
|
0
|
|
|
|
|
|
Enbld::Message->notify( |
451
|
|
|
|
|
|
|
"INFO:Enbld is set 'deploy mode'.\n" . |
452
|
|
|
|
|
|
|
"All targets will be deployed in $deploy_path." |
453
|
|
|
|
|
|
|
); |
454
|
|
|
|
|
|
|
} |
455
|
|
|
|
|
|
|
|
456
|
0
|
0
|
|
|
|
|
if ( Enbld::Feature->is_make_test_all ) { |
457
|
0
|
|
|
|
|
|
Enbld::Message->notify( |
458
|
|
|
|
|
|
|
"INFO:Enbld is set 'make test mode'.\n" . |
459
|
|
|
|
|
|
|
"All targets will be tested." |
460
|
|
|
|
|
|
|
); |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
0
|
0
|
|
|
|
|
if ( Enbld::Feature->is_force_install ) { |
464
|
0
|
|
|
|
|
|
Enbld::Message->notify( |
465
|
|
|
|
|
|
|
"INFO:Enbld is set 'force install mode'.\n" . |
466
|
|
|
|
|
|
|
"All targets will be builded by force." |
467
|
|
|
|
|
|
|
); |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
} |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
sub _err { |
473
|
0
|
|
|
0
|
|
|
my ( $msg, $param ) = @_; |
474
|
|
|
|
|
|
|
|
475
|
0
|
|
|
|
|
|
die( Enbld::Error->new( $msg, $param ) ); |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
1; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
__END__ |