| 1 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package App::Embra::Plugin::WrapZillaPlugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | $App::Embra::Plugin::WrapZillaPlugin::VERSION = '0.001'; # TRIAL | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: adapts a Dist::Zilla plugin to work with App::Embra | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Class::Inspector qw<>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Module::Runtime qw<>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Method::Signatures; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use App::Embra::Plugin::Zilla::WrapLog; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | has 'plugin' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | isa => func( $plugin ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | die q{can't wrap something that isn't a Dist::Zilla plugin!} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 5 | if not $plugin->does( 'Dist::Zilla::Role::Plugin' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | has 'plugin_args' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | default => func { {} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$class eq 'Dist::Zilla' || &$orig($self, $class)
MC/DC0%0/2
$class eq 'Dist::Zilla' || &$orig($self, $class)
$class eq 'Dist::Zilla'
&$orig($self, $class)
Truth table0%0/3
A || B
A= $class eq 'Dist::Zilla'B= &$orig($self, $class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | around 'isa' => func ( $orig, $self, $class ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_plugin: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | return $class eq 'Dist::Zilla' || $orig->($self, $class); # cheeky | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | method _build_plugin { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ( my $plugin_class = $self->name ) =~ s/^-/Dist::Zilla::Plugin::/xms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | if( not Class::Inspector->loaded( $plugin_class ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | Module::Runtime::require_module $plugin_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | return $plugin_class->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | zilla => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | plugin_name => $self->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | logger => App::Embra::Plugin::Zilla::WrapLog->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | proxy_prefix => '['.$self->name.'] ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | logger => $self->embra->logger, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | %{ $self->plugin_args }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BUILDARGS: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | ▶ | method BUILDARGS( @args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 10 | my %args = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | my %attrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | for my $attr ( qw< embra name plugin > ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | if( exists $args{$attr} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 5 | $attrs{$attr} = delete $args{$attr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 5 | ▶ | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
publish_site: called CC=4 SCAR=14.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 3 | ▶ | return { %attrs, plugin_args => \%args }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
Subroutine
__ANON__: called CC=3 SCAR=11.4
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | method publish_site { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 6 | my @wraps = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 6 | ▶ | [ '-AfterBuild' => func( $plugin ) { $plugin->after_build({ build_root => q<.> }) } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | [ '-BeforeRelease' => func( $plugin ) { $plugin->before_release() } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=14.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | for my $wrap ( @wraps ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | my( $role, $shim ) = @{ $wrap }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | $role =~ s/^-/Dist::Zilla::Role::/xms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | if( $self->plugin->does( $role ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | local *Dist::Zilla::VERSION = method { 4 }; # App::Embra::File->content, not ->encoded_content | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.5
Subroutine
extra_list_deps: not called CC=6 SCAR=35.1
Branch: 3 branches
Condition0%0/6
exists $args{"config"} and not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($config)
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
MC/DC0%0/2
exists $args{"config"} and not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($config)
exists $args{"config"}
not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($config)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
$Method::Signatures::mutc{"cache"}{"HashRef"}
"Method::Signatures"->_make_constraint("HashRef")
Truth table0%0/3
A and not(B)
A= exists $args{"config"}B= not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($config)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"HashRef"}B= "Method::Signatures"->_make_constraint("HashRef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $shim->( $self->plugin ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 5 | method extra_list_deps($class:, HashRef :$config) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ( my $plugin_class = $config->{_name} ) =~ s/^-/Dist::Zilla::Plugin::/xms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 5 | return $plugin_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | with 'App::Embra::Role::SitePublisher'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | with 'App::Embra::Role::ExtraListDeps'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 5 | has '+embra' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | handles => [ qw< files > ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||