line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Metadata; |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Copyright 2010 Christopher J. Madsen |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Author: Christopher J. Madsen <perl@cjmweb.net> |
7
|
|
|
|
|
|
|
# Created: 2 Dec 2010 |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
10
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
13
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the |
15
|
|
|
|
|
|
|
# GNU General Public License or the Artistic License for more details. |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# ABSTRACT: Add arbitrary keys to distmeta |
18
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '3.03'; |
21
|
|
|
|
|
|
|
# This file is part of Dist-Zilla-Plugins-CJM 4.26 (December 13, 2014) |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
1191
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has metadata => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'HashRef', |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
35
|
|
|
|
|
|
|
sub BUILDARGS |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
my ($class, @arg) = @_; |
38
|
|
|
|
|
|
|
my %copy = ref $arg[0] ? %{$arg[0]} : @arg; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $zilla = delete $copy{zilla}; |
41
|
|
|
|
|
|
|
my $name = delete $copy{plugin_name}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my %metadata; |
44
|
|
|
|
|
|
|
while (my ($key, $value) = each %copy) { |
45
|
|
|
|
|
|
|
my @keys = split (/\./, $key, -1); |
46
|
|
|
|
|
|
|
my $hash = \%metadata; |
47
|
|
|
|
|
|
|
while (@keys > 1) { |
48
|
|
|
|
|
|
|
$hash = $hash->{shift @keys} ||= {}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$hash->{$keys[0]} = $value; |
52
|
|
|
|
|
|
|
} # end while each %copy |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return { |
55
|
|
|
|
|
|
|
zilla => $zilla, |
56
|
|
|
|
|
|
|
plugin_name => $name, |
57
|
|
|
|
|
|
|
metadata => \%metadata, |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} # end BUILDARGS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
62
|
|
|
|
|
|
|
sub mvp_multivalue_args |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
return qw(author keywords license no_index.file no_index.directory |
65
|
|
|
|
|
|
|
no_index.package no_index.namespace resources.license ); |
66
|
|
|
|
|
|
|
} # end mvp_multivalue_args |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#===================================================================== |
69
|
|
|
|
|
|
|
no Moose; |
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Metadata - Add arbitrary keys to distmeta |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This document describes version 3.03 of |
82
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Metadata, released December 13, 2014 |
83
|
|
|
|
|
|
|
as part of Dist-Zilla-Plugins-CJM version 4.26. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SYNOPSIS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
In your F<dist.ini>: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
[Metadata] |
90
|
|
|
|
|
|
|
dynamic_config = 1 |
91
|
|
|
|
|
|
|
resources.homepage = http://example.com |
92
|
|
|
|
|
|
|
resources.bugtracker.mailto = bugs@example.com |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 DESCRIPTION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The Metadata plugin allows you to add arbitrary keys to your |
97
|
|
|
|
|
|
|
distribution's metadata. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
It splits each key on '.' and uses that as a multi-level hash key. It |
100
|
|
|
|
|
|
|
doesn't try to do any validation; the MetaJSON or MetaYAML plugin will |
101
|
|
|
|
|
|
|
do that. It does know which keys in the spec are List values; those |
102
|
|
|
|
|
|
|
keys can be repeated. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=for Pod::Coverage |
105
|
|
|
|
|
|
|
mvp_multivalue_args |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Metadata requires no configuration files or environment variables. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Metadata requires L<Dist::Zilla> (4.300009 or later). |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
None reported. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
No bugs have been reported. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Christopher J. Madsen S<C<< <perl AT cjmweb.net> >>> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Please report any bugs or feature requests |
128
|
|
|
|
|
|
|
to S<C<< <bug-Dist-Zilla-Plugins-CJM AT rt.cpan.org> >>> |
129
|
|
|
|
|
|
|
or through the web interface at |
130
|
|
|
|
|
|
|
L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugins-CJM >>. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
You can follow or contribute to Dist-Zilla-Plugins-CJM's development at |
133
|
|
|
|
|
|
|
L<< https://github.com/madsen/dist-zilla-plugins-cjm >>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Christopher J. Madsen. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
140
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
145
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
146
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
147
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
148
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
149
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
150
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
151
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
152
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
155
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
156
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE |
157
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
158
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
159
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
160
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
161
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
162
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
163
|
|
|
|
|
|
|
SUCH DAMAGES. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |