Enbld/Command/Deploy.pm untested

filter: Statementstmt 0.0% 0 / 57 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 76 SCAR 30.0
CC
4
Cov
0%
do
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 20.0
1 package Enbld::Command::Deploy;
2  
3 use strict;
4 use warnings;
5  
6 use 5.010001;
7  
8 use parent qw/Enbld::Command/;
9  
10 use Try::Lite;
11  
12 require Enbld::Feature;
13 require Enbld::Home;
14 require Enbld::Logger;
15 require Enbld::App::Configuration;
16 require Enbld::Target;
17 require Enbld::Deployed;
18  
19 sub do {
20 my $self = shift;
21  
22 my $deploy_path = shift @{ $self->{argv} };
23  
24 unless ( $deploy_path ) {
25 die( "ERROR:'deploy' command requires directory path argument.\n" );
26 }
27  
28 Enbld::Feature->set_deploy_mode( $deploy_path );
29 Enbld::Home->initialize;
30 Enbld::Home->create_build_directory;
31 Enbld::Logger->rotate( Enbld::Home->log );
32  
33 Enbld::App::Configuration->read_file;
34  
35 foreach my $name ( keys %{ Enbld::App::Configuration->config } ) {
36 my $config = Enbld::App::Configuration->search_config( $name );
37  
38 next unless $config->enabled;
39  
40 my $target = Enbld::Target->new( $name, $config );
41 my $condition = {
42 $name => $config->condition( $config->enabled ),
43 };
44  
45 my $installed = try {
46 return $target->deploy_declared( $condition );
47 } ( 'Enbld::Error' => sub {
48 Enbld::Message->alert( $@ );
49 say "Please check build logile:" . Enbld::Logger->logfile;
50  
51 return;
52 }
53 );
54  
55 # installed
56 if ( $installed ) {
57 Enbld::Deployed->add( $installed );
58 }
59 }
60 }
61  
62 1;