blib/lib/Dist/Zilla/MVP/RootSection.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 96.0% 48 / 50 CC 3 SCAR 4.4
CC
3
Cov
95%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« blib/lib/Dist/Zilla/Plugin/AutoVersion.pm ↑ Summary blib/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm »
1 package Dist::Zilla::MVP::RootSection 6.040;
2 # ABSTRACT: a standard section in Dist::Zilla's configuration sequence
3  
4 51 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 51 extends 'Config::MVP::Section';
6  
7 51 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 51 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #pod =head1 DESCRIPTION
12 #pod
13 #pod This is a subclass of L<Config::MVP::Section>, used as the starting section by
14 #pod L<Dist::Zilla::MVP::Assembler::Zilla>. It has a number of useful defaults, as
15 #pod well as a C<zilla> attribute which will, after section finalization, contain a
16 #pod Dist::Zilla object with which subsequent plugin sections may register.
17 #pod
18 #pod Those useful defaults are:
19 #pod
20 #pod =for :list
21 #pod * name defaults to _
22 #pod * aliases defaults to { author => 'authors' }
23 #pod * multivalue_args defaults to [ 'authors' ]
24 #pod
25 #pod =cut
26  
27 51 ▶use MooseX::LazyRequire;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 51 ▶use MooseX::SetOnce;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 51 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 51 has '+name' => (default => '_');
32  
33 199 ▶has '+aliases' => (default => sub { return { author => 'authors' } });
Subroutine __ANON__: called CC=1 SCAR=0.0
34  
35 199 ▶has '+multivalue_args' => (default => sub { [ qw(authors) ] });
Subroutine __ANON__: called CC=1 SCAR=0.0
36  
37 51 has zilla => (
38 is => 'ro',
39 isa => class_type('Dist::Zilla'),
40 traits => [ qw(SetOnce) ],
41 writer => 'set_zilla',
42 lazy_required => 1,
43 );
44  
45 199 ▶after finalize => sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
46 199 my ($self) = @_;
47  
48 199 my $assembler = $self->sequence->assembler;
49  
50 199 my %payload = %{ $self->payload };
51  
52 199 my %dzil;
53 199 $dzil{$_} = delete $payload{":$_"} for grep { s/\A:// } keys %payload;
54  
55 199 my $zilla = $assembler->zilla_class->new( \%payload );
56  
57 199 ▶ if (defined $dzil{version}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $dzil{"version"}) 0 199 199
58 Dist::Zilla::Util->_assert_loaded_class_version_ok(
59 'Dist::Zilla',
60 $dzil{version},
61 0 );
62 }
63  
64 199 $self->set_zilla($zilla);
65 51 };
66  
67 51 __PACKAGE__->meta->make_immutable;
68 51 1;
69  
70 __END__
« blib/lib/Dist/Zilla/Plugin/AutoVersion.pm ↑ Summary blib/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm »