| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%2/6
exists $args{"sequence"} and not +($Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence"))->check($sequence)
$Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"} ||= "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
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)
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Config::MVP::Sequence"}B= "Method::Signatures"->_make_constraint("Config::MVP::Sequence")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | my $payload = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 6 | ▶ | if ( my $root_section = $sequence->section_named( '_' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||