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   2688 use strict;
  5         10  
  5         115  
2 5     5   21 use warnings;
  5         7  
  5         182  
3              
4             package Footprintless::App::Command::deployment::deploy;
5             $Footprintless::App::Command::deployment::deploy::VERSION = '1.28';
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         6  
  5         20  
10              
11 5     5   255 use Footprintless::App -ignore;
  5         10  
  5         23  
12 5     5   830 use Log::Any;
  5         9  
  5         21  
13              
14             my $logger = Log::Any->get_logger();
15              
16             sub execute {
17 1     1 1 7 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         20 $self->{deployment}->deploy();
25              
26 1         13 $logger->info('Done...');
27             }
28              
29             sub opt_spec {
30 1     1 1 14 return ( [ "clean", "will cause clean to be run before deploy" ] );
31             }
32              
33             sub usage_desc {
34 1     1 1 9 return "fpl deployment DEPLOYMENT_COORD deploy %o";
35             }
36              
37             sub validate_args {
38 1     1 1 4 my ( $self, $opts, $args ) = @_;
39              
40 1         2 eval { $self->{deployment} = $self->{footprintless}->deployment( $self->{coordinate} ); };
  1         9  
41              
42 1 50       8 $self->usage_error("invalid coordinate [$self->{coordinate}]: $@") if ($@);
43             }
44              
45             1;
46              
47             __END__