File Coverage

blib/lib/Dist/Zilla/Plugin/MetaConfig.pm
Criterion Covered Total %
statement 21 21 100.0
branch 3 4 75.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 28 30 93.3


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::MetaConfig 6.029;
2             # ABSTRACT: summarize Dist::Zilla configuration into distmeta
3              
4 3     3   2590 use Moose;
  3         8  
  3         24  
5             with 'Dist::Zilla::Role::MetaProvider';
6              
7 3     3   21427 use Dist::Zilla::Pragmas;
  3         10  
  3         39  
8              
9 3     3   29 use namespace::autoclean;
  3         6  
  3         27  
10              
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod This plugin adds a top-level C<x_Dist_Zilla> key to the
14             #pod L<distmeta|Dist::Zilla/distmeta> for the distribution. It describe the
15             #pod Dist::Zilla version used as well as all the plugins used. Each plugin's name,
16             #pod package, and version will be included. Plugins may augment their
17             #pod implementation of the L<Dist::Zilla::Role::ConfigDumper> role methods to add
18             #pod more data to this dump.
19             #pod
20             #pod More information may be added to the top-level of this metadata as time goes
21             #pod on.
22             #pod
23             #pod =cut
24              
25             sub metadata {
26 3     3 0 14 my ($self) = @_;
27              
28 3         10 my $dump = { };
29              
30 3         10 my @plugins;
31 3         10 $dump->{plugins} = \@plugins;
32              
33 3         150 my $config = $self->zilla->dump_config;
34             $dump->{zilla} = {
35 3 50       96 class => $self->zilla->meta->name,
36             version => $self->zilla->VERSION,
37             (keys %$config ? (config => $config) : ()),
38             };
39              
40             $dump->{perl} = {
41 3         17 version => "$]",
42             };
43              
44 3         8 for my $plugin (@{ $self->zilla->plugins }) {
  3         88  
45 57         197 my $config = $plugin->dump_config;
46              
47 57 100       191 push @plugins, {
48             class => $plugin->meta->name,
49             name => $plugin->plugin_name,
50             version => $plugin->VERSION,
51             (keys %$config ? (config => $config) : ()),
52             };
53             }
54              
55 3         20 return { x_Dist_Zilla => $dump };
56             }
57              
58             __PACKAGE__->meta->make_immutable;
59             1;
60              
61             #pod =head1 SEE ALSO
62             #pod
63             #pod Dist::Zilla roles: L<MetaProvider|Dist::Zilla::Role::MetaProvider>.
64             #pod
65             #pod =cut
66              
67             __END__
68              
69             =pod
70              
71             =encoding UTF-8
72              
73             =head1 NAME
74              
75             Dist::Zilla::Plugin::MetaConfig - summarize Dist::Zilla configuration into distmeta
76              
77             =head1 VERSION
78              
79             version 6.029
80              
81             =head1 DESCRIPTION
82              
83             This plugin adds a top-level C<x_Dist_Zilla> key to the
84             L<distmeta|Dist::Zilla/distmeta> for the distribution. It describe the
85             Dist::Zilla version used as well as all the plugins used. Each plugin's name,
86             package, and version will be included. Plugins may augment their
87             implementation of the L<Dist::Zilla::Role::ConfigDumper> role methods to add
88             more data to this dump.
89              
90             More information may be added to the top-level of this metadata as time goes
91             on.
92              
93             =head1 PERL VERSION
94              
95             This module should work on any version of perl still receiving updates from
96             the Perl 5 Porters. This means it should work on any version of perl released
97             in the last two to three years. (That is, if the most recently released
98             version is v5.40, then this module should work on both v5.40 and v5.38.)
99              
100             Although it may work on older versions of perl, no guarantee is made that the
101             minimum required version will not be increased. The version may be increased
102             for any reason, and there is no promise that patches will be accepted to lower
103             the minimum required perl.
104              
105             =head1 SEE ALSO
106              
107             Dist::Zilla roles: L<MetaProvider|Dist::Zilla::Role::MetaProvider>.
108              
109             =head1 AUTHOR
110              
111             Ricardo SIGNES 😏 <cpan@semiotic.systems>
112              
113             =head1 COPYRIGHT AND LICENSE
114              
115             This software is copyright (c) 2022 by Ricardo SIGNES.
116              
117             This is free software; you can redistribute it and/or modify it under
118             the same terms as the Perl 5 programming language system itself.
119              
120             =cut