blib/lib/Dancer2/CLI.pm

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