File Coverage

blib/lib/Footprintless/App/Command/deployment/deploy.pm
Criterion Covered Total %
statement 26 28 92.8
branch 2 4 50.0
condition n/a
subroutine 9 9 100.0
pod 4 4 100.0
total 41 45 91.1


line stmt bran cond sub pod time code
1 5     5   2152 use strict;
  5         12  
  5         117  
2 5     5   24 use warnings;
  5         10  
  5         188  
3              
4             package Footprintless::App::Command::deployment::deploy;
5             $Footprintless::App::Command::deployment::deploy::VERSION = '1.26';
6             # ABSTRACT: deploys all files managed by the deployment
7             # PODNAME: Footprintless::App::Command::deployment::deploy
8              
9 5     5   24 use parent qw(Footprintless::App::Action);
  5         7  
  5         25  
10              
11 5     5   263 use Footprintless::App -ignore;
  5         9  
  5         24  
12 5     5   802 use Log::Any;
  5         11  
  5         20  
13              
14             my $logger = Log::Any->get_logger();
15              
16             sub execute {
17 1     1 1 3 my ( $self, $opts, $args ) = @_;
18              
19 1 50       6 if ( $opts->{clean} ) {
20 0         0 $logger->info('Performing clean...');
21 0         0 $self->{deployment}->clean();
22             }
23 1         6 $logger->info('Performing deploy...');
24 1         36 $self->{deployment}->deploy();
25              
26 1         64 $logger->info('Done...');
27             }
28              
29             sub opt_spec {
30 1     1 1 9 return ( [ "clean", "will cause clean to be run before deploy" ] );
31             }
32              
33             sub usage_desc {
34 1     1 1 4 return "fpl deployment DEPLOYMENT_COORD deploy %o";
35             }
36              
37             sub validate_args {
38 1     1 1 3 my ( $self, $opts, $args ) = @_;
39              
40 1         2 eval { $self->{deployment} = $self->{footprintless}->deployment( $self->{coordinate} ); };
  1         7  
41              
42 1 50       5 $self->usage_error("invalid coordinate [$self->{coordinate}]: $@") if ($@);
43             }
44              
45             1;
46              
47             __END__