blib/lib/Dancer2/CLI.pm

filter: Statementstmt 89.1% 33 / 37 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 78.5% 11 / 14 Podpod 0.0% 0 / 1 totaltotal 83.3% 45 / 54 CC 2 SCAR 2.3
CC
2
Cov
87%
_get_perl_interpreter
2.1
run
2.0
__ANON__
1.1
CRAP 1.3
« blib/lib/Dancer2/CLI/Version.pm ↑ Summary blib/lib/Dancer2/Session/Simple.pm »
1 package Dancer2::CLI;
2 # ABSTRACT: Dancer2 CLI application
3 6 $Dancer2::CLI::VERSION = '2.2.2';
4 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use CLI::Osprey;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use File::Share 'dist_dir';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Module::Runtime 'use_module';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 subcommand gen => 'Dancer2::CLI::Gen';
11 6 subcommand 'gen-app' => 'Dancer2::CLI::Gen';
12  
13 # Could have done this one inline, but wanted to remain consistent
14 # across subcommands.
15 6 subcommand version => 'Dancer2::CLI::Version';
16  
17 # Thinking ahead, these might be useful in future subcommands
18 has _dancer2_version => (
19 is => 'lazy',
20 0 ▶ builder => sub { use_module( 'Dancer2' )->VERSION },
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine _build__dancer2_version: called CC=1 SCAR=1.2
21 6 );
22  
23 has _dist_dir => (
24 is => 'lazy',
25 0 ▶ builder => sub{ dist_dir('Dancer2') },
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine _build__dist_dir: called CC=1 SCAR=1.2
26 6 );
27  
28 0 ▶sub run {
Subroutine run: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my $self = shift;
30 0 return $self->osprey_usage;
31 }
32  
33 4 ▶sub _get_app_path {
Subroutine _get_app_path: called CC=1 SCAR=0.0
34 4 my ( $self, $path, $appname ) = @_;
35 4 return path( $path, $self->_get_dashed_name( $appname ));
36 }
37  
38 4 ▶sub _get_app_file {
Subroutine _get_app_file: called CC=1 SCAR=0.0
39 4 my ( $self, $appname ) = @_;
40 4 $appname =~ s{::}{/}g;
41 4 return path( 'lib', "$appname.pm" );
42 }
43  
44 4 ▶sub _get_perl_interpreter {
Subroutine _get_perl_interpreter: called CC=2 SCAR=7.6
45 4 ▶ return -r '/usr/bin/env' ? '#!/usr/bin/env perl' : "#!$^X";
Branch: 1 branch
BranchTrueFalseTotal
-r '/usr/bin/env' ? : 4 0 4
46 }
47  
48 8 ▶sub _get_dashed_name {
Subroutine _get_dashed_name: called CC=1 SCAR=0.0
49 8 my ( $self, $name ) = @_;
50 8 $name =~ s{::}{-}g;
51 8 return $name;
52 }
53  
54 6 1;
55  
56 __END__
« blib/lib/Dancer2/CLI/Version.pm ↑ Summary blib/lib/Dancer2/Session/Simple.pm »