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