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   3002 use strict;
  5         12  
  5         125  
2 5     5   22 use warnings;
  5         8  
  5         200  
3              
4             package Footprintless::App::Command::deployment::deploy;
5             $Footprintless::App::Command::deployment::deploy::VERSION = '1.29';
6             # ABSTRACT: deploys all files managed by the deployment
7             # PODNAME: Footprintless::App::Command::deployment::deploy
8              
9 5     5   21 use parent qw(Footprintless::App::Action);
  5         9  
  5         31  
10              
11 5     5   285 use Footprintless::App -ignore;
  5         9  
  5         25  
12 5     5   791 use Log::Any;
  5         10  
  5         20  
13              
14             my $logger = Log::Any->get_logger();
15              
16             sub execute {
17 1     1 1 4 my ( $self, $opts, $args ) = @_;
18              
19 1 50       9 if ( $opts->{clean} ) {
20 0         0 $logger->info('Performing clean...');
21 0         0 $self->{deployment}->clean();
22             }
23 1         14 $logger->info('Performing deploy...');
24 1         21 $self->{deployment}->deploy();
25              
26 1         13 $logger->info('Done...');
27             }
28              
29             sub opt_spec {
30 1     1 1 18 return ( [ "clean", "will cause clean to be run before deploy" ] );
31             }
32              
33             sub usage_desc {
34 1     1 1 5 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         1 eval { $self->{deployment} = $self->{footprintless}->deployment( $self->{coordinate} ); };
  1         5  
41              
42 1 50       10 $self->usage_error("invalid coordinate [$self->{coordinate}]: $@") if ($@);
43             }
44              
45             1;
46              
47             __END__