File Coverage

blib/lib/Dist/Zilla/MVP/Assembler.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 6 6 100.0
pod 1 2 50.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             # ABSTRACT: Dist::Zilla-specific subclass of Config::MVP::Assembler
2              
3             use Moose;
4 50     50   2826 extends 'Config::MVP::Assembler';
  50         123  
  50         421  
5             with 'Config::MVP::Assembler::WithBundles' => { -version => '2.200010' };
6              
7             use Dist::Zilla::Pragmas;
8 50     50   350203  
  50         139  
  50         366  
9             use namespace::autoclean;
10 50     50   438  
  50         147  
  50         399  
11             use Dist::Zilla::Util;
12 50     50   3739  
  50         166  
  50         21716  
13             #pod =head1 DESCRIPTION
14             #pod
15             #pod B<Take this next bit seriously!> If you don't understand how L<Config::MVP>
16             #pod works, reading about how the Dist::Zilla-specific Assembler works is not going
17             #pod to be useful.
18             #pod
19             #pod Dist::Zilla::MVP::Assembler extends L<Config::MVP::Assembler> and composes
20             #pod L<Config::MVP::Assembler::WithBundles>. For potential plugin bundles (things
21             #pod composing L<Dist::Zilla::Role::PluginBundle>)
22             #pod
23             #pod The Assembler has chrome, so it can log and will (eventually) be able to get
24             #pod input from the user.
25             #pod
26             #pod The Assembler's C<expand_package> method delegates to Dist::Zilla::Util's
27             #pod L<expand_config_package_name|Dist::Zilla::Util/expand_config_package_name>
28             #pod method.
29             #pod
30             #pod The Assembler will throw an exception if it is instructed to add a value for
31             #pod C<plugin_name> or C<zilla>.
32             #pod
33             #pod =cut
34              
35             has chrome => (
36             is => 'rw',
37             does => 'Dist::Zilla::Role::Chrome',
38             required => 1,
39             );
40              
41             has logger => (
42             is => 'ro',
43             isa => 'Log::Dispatchouli::Proxy', # could be duck typed, I guess
44             lazy => 1,
45             handles => [ qw(log log_debug log_fatal) ],
46             default => sub {
47             $_[0]->chrome->logger->proxy({ proxy_prefix => '[DZ] ' })
48             },
49             );
50              
51             return scalar Dist::Zilla::Util->expand_config_package_name($_[1]);
52             }
53 624     624 1 164768  
54             my ($self, $pkg) = @_;
55             return unless $pkg->isa('Moose::Object')
56             and $pkg->does('Dist::Zilla::Role::PluginBundle');
57 764     764 0 143971 return 'bundle_config';
58 764 100 66     7806 }
59              
60 10         3493 before add_value => sub {
61             my ($self, $name) = @_;
62              
63             return unless $name =~ /\A(?:plugin_name|zilla)\z/;
64              
65             my $section_name = $self->current_section->name;
66             $self->log_fatal(
67             "$section_name arguments attempted to provide reserved argument $name"
68             );
69             };
70              
71             __PACKAGE__->meta->make_immutable;
72             1;
73              
74              
75             =pod
76              
77             =encoding UTF-8
78              
79             =head1 NAME
80              
81             Dist::Zilla::MVP::Assembler - Dist::Zilla-specific subclass of Config::MVP::Assembler
82              
83             =head1 VERSION
84              
85             version 6.028
86              
87             =head1 DESCRIPTION
88              
89             B<Take this next bit seriously!> If you don't understand how L<Config::MVP>
90             works, reading about how the Dist::Zilla-specific Assembler works is not going
91             to be useful.
92              
93             Dist::Zilla::MVP::Assembler extends L<Config::MVP::Assembler> and composes
94             L<Config::MVP::Assembler::WithBundles>. For potential plugin bundles (things
95             composing L<Dist::Zilla::Role::PluginBundle>)
96              
97             The Assembler has chrome, so it can log and will (eventually) be able to get
98             input from the user.
99              
100             The Assembler's C<expand_package> method delegates to Dist::Zilla::Util's
101             L<expand_config_package_name|Dist::Zilla::Util/expand_config_package_name>
102             method.
103              
104             The Assembler will throw an exception if it is instructed to add a value for
105             C<plugin_name> or C<zilla>.
106              
107             =head1 PERL VERSION
108              
109             This module should work on any version of perl still receiving updates from
110             the Perl 5 Porters. This means it should work on any version of perl released
111             in the last two to three years. (That is, if the most recently released
112             version is v5.40, then this module should work on both v5.40 and v5.38.)
113              
114             Although it may work on older versions of perl, no guarantee is made that the
115             minimum required version will not be increased. The version may be increased
116             for any reason, and there is no promise that patches will be accepted to lower
117             the minimum required perl.
118              
119             =head1 AUTHOR
120              
121             Ricardo SIGNES 😏 <cpan@semiotic.systems>
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is copyright (c) 2022 by Ricardo SIGNES.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut