blib/lib/Clustericious/Command/nginx.pm

filter: Statementstmt 70.0% 28 / 40 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 61.6% 37 / 60 CC 6 SCAR 29.2
CC
6
Cov
56%
run
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 18.6
« blib/lib/Clustericious/Plugin/CommonRoutes.pm ↑ Summary blib/lib/Clustericious/Plugin/PlugAuth.pm »
1 package Clustericious::Command::nginx;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Clustericious::App;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Clustericious::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Path qw( mkpath );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base 'Clustericious::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Clustericious::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Which qw( which );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # ABSTRACT: Clustericious command to stat nginx
13 1 our $VERSION = '1.29'; # VERSION
14  
15  
16 1 __PACKAGE__->attr(description => <<EOT);
17 Start an nginx web server.
18 EOT
19  
20 1 __PACKAGE__->attr(usage => <<EOT);
21 Usage $0: nginx -p <prefix> [...other nginx options]
22 Starts an nginx webserver.
23 Options are passed verbatim to the nginx executable.
24 EOT
25  
26 0 ▶sub run {
Subroutine run: not called CC=6 SCAR=37.4
Pod documented
27 0 my($self, @args) = @_;
28 0 my $app_name = $ENV{MOJO_APP};
29 0 my %args = @args;
30  
31 0 $self->app->init_logging;
32  
33 0 ▶ my $prefix = $args{-p} or INFO "no prefix for nginx";
Branch: 1 branch
BranchTrueFalseTotal
my $prefix = $args{"-p"} or INFO("no prefix for nginx") 0 0 0
34 0 mkpath "$prefix/logs";
35  
36 0 ▶ my $nginx = which('nginx') or LOGDIE "could not find nginx in $ENV{PATH}";
Branch: 1 branch
BranchTrueFalseTotal
my $nginx = which("nginx") or LOGDIE(qq[could not find nginx in $ENV{"PATH"}]) 0 0 0
37 0 DEBUG "starting $nginx @args";
38 0 system$nginx, @args;
39 0 ▶ die "'$nginx @args' Failed to execute: $!" if $? == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $? == -1 0 0 0
40 0 ▶ die "'$nginx @args' Killed with signal: ", $? & 127 if $? & 127;
Branch: 1 branch
BranchTrueFalseTotal
if $? & 127 0 0 0
41 0 ▶ die "'$nginx @args' Exited with ", $? >> 8 if $? >> 8;
Branch: 1 branch
BranchTrueFalseTotal
if $? >> 8 0 0 0
42 }
43  
44 1 1;
45  
46 __END__
« blib/lib/Clustericious/Plugin/CommonRoutes.pm ↑ Summary blib/lib/Clustericious/Plugin/PlugAuth.pm »