blib/lib/Clustericious/Command/plackup.pm

filter: Statementstmt 66.6% 28 / 42 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 56.0% 37 / 66 CC 5 SCAR 25.0
CC
5
Cov
54%
run
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 12.2
« blib/lib/Clustericious/Log.pm ↑ Summary blib/lib/Test/Clustericious/Command.pm »
1 package Clustericious::Command::plackup;
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::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Clustericious::App;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Mojo::Server::PSGI;
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 File::Which qw( which );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # ABSTRACT: Clustericious command to start plack server
13 1 our $VERSION = '1.29'; # VERSION
14  
15  
16 1 __PACKAGE__->attr(description => <<EOT);
17 Start a plack server (see plackup)
18 EOT
19  
20 1 __PACKAGE__->attr(usage => <<EOT);
21 Usage $0: plackup [plackup options]
22 Starts a plack server. See plackup for valid options.
23 EOT
24  
25 0 ▶sub run {
Subroutine run: not called CC=5 SCAR=34.0
Pod documented
26 0 my($self, @args) = @_;
27 0 my $app_name = $ENV{MOJO_APP};
28
29 0 $self->app->init_logging;
30  
31 0 ▶ my $plackup = which('plackup') || LOGDIE "could not find plackup in $ENV{PATH}";
Condition0%0/3
which('plackup') || LOGDIE("could not find plackup in $ENV{'PATH'}")
l!l&&r!l&&!r
000
MC/DC0%0/2
which('plackup') || LOGDIE("could not find plackup in $ENV{'PATH'}")
which('plackup') LOGDIE("could not find plackup in $ENV{'PATH'}")
Truth table0%0/3
A || B
A= which('plackup')B= LOGDIE("could not find plackup in $ENV{'PATH'}")
ABresult
1X1
011
000
32  
33 0 my $url = Mojo::URL->new($self->app->config->url);
34 0 ▶ LOGDIE "@{[ $url->scheme ]} not supported" if $url->scheme ne 'http';
Branch: 1 branch
BranchTrueFalseTotal
if $url->scheme ne "http" 0 0 0
35
36 0 ▶ shift @args if defined $args[0] && $args[0] eq 'plackup';
Branch: 1 branch
BranchTrueFalseTotal
if defined $args[0] and $args[0] eq "plackup" 0 0 0
Condition0%0/3
defined $args[0] and $args[0] eq "plackup"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $args[0] and $args[0] eq "plackup"
defined $args[0] $args[0] eq "plackup"
Truth table0%0/3
A and B
A= defined $args[0]B= $args[0] eq "plackup"
ABresult
0X0
100
111
37 0 push @args, $0;
38 0 unshift @args, '--port' => $url->port;
39 0 unshift @args, '--host' => $url->host;
40
41 #if(my $pid_file = $self->app->config->plackup(default => {})->pid_file(default => 0))
42 #{
43 # unshift @args, '--pidfile' => $pid_file;
44 #}
45
46 0 DEBUG "starting $plackup @args";
47 0 delete $ENV{MOJO_COMMANDS_DONE};
48 0 exec $plackup, @args;
49 }
50  
51 1 1;
52  
53 __END__
« blib/lib/Clustericious/Log.pm ↑ Summary blib/lib/Test/Clustericious/Command.pm »