Embra.pm

filter: Statementstmt 100% 94 / 94 Branchbran 55.2% 21 / 38 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 20 / 20 Podpod n/a totaltotal 84.5% 137 / 162 CC 28 SCAR 15.5
CC
28
Cov
85%
from_config_mvp_sequence
10.2
collate
7.0
__ANON__
4.2
CRAP 4.7
« Embra/Plugin/GatherDir.pm ↑ Summary Embra/App/Command.pm »
1 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package App::Embra;
5 24 $App::Embra::VERSION = '0.001'; # TRIAL
6 # ABSTRACT: build a site from parts
7  
8 24 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 24 with 'App::Embra::Role::Logging';
13  
14 5 ▶around '_build_log_prefix' => func( $orig, $self ) {
Subroutine __ANON__: called CC=4 SCAR=14.5
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 5 5
unless scalar @_ > 1 0 5 5
if scalar @_ > 2 0 5 5
15 5 return "[Embra] ";
16 24 };
17  
18 19 ▶around '_build_logger' => func( $orig, $self ) {
Subroutine __ANON__: called CC=4 SCAR=14.5
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 19 19
unless scalar @_ > 1 0 19 19
if scalar @_ > 2 0 19 19
19 19 return Log::Any->get_logger;
20 24 };
21  
22  
23 has 'plugins' => (
24 is => 'ro',
25 24 ▶ default => sub{[]},
Subroutine __ANON__: called CC=1 SCAR=0.0
26 24 );
27  
28  
29 has 'files' => (
30 is => 'ro',
31 8 ▶ default => sub{[]},
Subroutine __ANON__: called CC=1 SCAR=0.0
32 24 );
33  
34  
35 24 ▶method from_config_mvp_sequence( $class:, Config::MVP::Sequence :$sequence ) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine from_config_mvp_sequence: called CC=9 SCAR=23.2
Branch: 3 branches
BranchTrueFalseTotal
if exists $args{"sequence"} and not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence) 0 6 6
if keys %args 0 6 6
if scalar @_ > 2 0 6 6
Condition33%2/6
exists $args{"sequence"} and not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence)
!ll&&!rl&&r
060
$Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
l!l&&r!l&&!r
060
MC/DC0%0/2
exists $args{"sequence"} and not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence)
exists $args{"sequence"} not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
$Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
Truth table33%1/3
A and not(B)
A= exists $args{"sequence"}B= not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence)
ABresult
0X0
100
111
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"}B= "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
ABresult
1X1
011
000
36 6 my $payload = {};
37 6 ▶ if ( my $root_section = $sequence->section_named( '_' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $root_section = $sequence->section_named("_")) 6 0 6
38 6 $payload = $root_section->payload;
39 }
40 6 my $creatura = $class->new( $payload );
41 6 for my $plugin_section ( $sequence->sections ) {
42 13 ▶ next if $plugin_section->name eq '_';
Branch: 1 branch
BranchTrueFalseTotal
if $plugin_section->name eq "_" 6 7 13
43 7 $plugin_section->package->register_plugin(
44 name => $plugin_section->name,
45 args => $plugin_section->payload,
46 embra => $creatura,
47 );
48 }
49 6 $creatura;
50 }
51  
52  
53 24 ▶method add_plugin( $plugin where { $_->DOES( "App::Embra::Role::Plugin" ) } ) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine add_plugin: called CC=4 SCAR=13.9
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 12 12
unless do { grep {$_ ~~ sub { $_->DOES("App::Embra::Role::Plugin"); } ;} $plugin } 1 11 12
if scalar @_ > 1 0 11 11
54 11 push @{ $self->plugins}, $plugin;
55 }
56  
57  
58 24 ▶method find_plugin( $class ) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine find_plugin: called CC=3 SCAR=11.1
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 1 1
if scalar @_ > 1 0 1 1
59 1 ( grep { ref $_ eq $class } @{ $self->plugins } )[0];
60 }
61  
62  
63 24 ▶method collate {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine collate: called CC=7 SCAR=19.5
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 5 5
64 5 $self->debug( 'collating' );
65 5 $_->gather_files for $self->plugins_with( -FileGatherer );
66 5 $_->prune_files for $self->plugins_with( -FilePruner );
67 5 $_->transform_files for $self->plugins_with( -FileTransformer );
68 5 $_->assemble_files for $self->plugins_with( -FileAssembler );
69 5 $_->publish_site for $self->plugins_with( -SitePublisher );
70 }
71  
72  
73 24 ▶method plugins_with( $rolename ) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine plugins_with: called CC=3 SCAR=11.1
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 28 28
if scalar @_ > 1 0 28 28
74 28 $rolename =~ s/^-/App::Embra::Role::/xms;
75 28 return grep { $_->does( $rolename ) } @{ $self->plugins };
76 }
77  
78  
79 24 1;
80  
81 __END__
« Embra/Plugin/GatherDir.pm ↑ Summary Embra/App/Command.pm »