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