blib/lib/Dancer2/CLI.pm

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