line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::MetaMergeFile; |
2
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::MetaMergeFile::VERSION = '0.002'; |
3
|
1
|
|
|
1
|
|
3519249
|
use Moose; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
7240
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::MetaProvider Dist::Zilla::Role::PrereqSource/; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
668
|
use MooseX::Types::Stringlike 'Stringlike'; |
|
1
|
|
|
|
|
46739
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
2515
|
use Parse::CPAN::Meta; |
|
1
|
|
|
|
|
1834
|
|
|
1
|
|
|
|
|
346
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @defaults = qw/metamerge.json metamerge.yml/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has filename => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => Stringlike, |
16
|
|
|
|
|
|
|
default => sub { |
17
|
|
|
|
|
|
|
return (grep { -f } @defaults)[0]; |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has _rawdata => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
builder => '_build_rawdata', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_rawdata { |
28
|
1
|
|
|
1
|
|
4
|
my $self = shift; |
29
|
1
|
|
|
|
|
37
|
return Parse::CPAN::Meta->load_file($self->filename); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub metadata { |
33
|
1
|
|
|
1
|
0
|
6177
|
my $self = shift; |
34
|
1
|
|
|
|
|
3
|
my %data = %{ $self->_rawdata }; |
|
1
|
|
|
|
|
42
|
|
35
|
1
|
|
|
|
|
4
|
delete $data{prereqs}; |
36
|
1
|
|
|
|
|
7
|
return \%data; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub register_prereqs { |
40
|
1
|
|
|
1
|
0
|
443840
|
my $self = shift; |
41
|
1
|
|
|
|
|
41
|
my $prereqs = $self->_rawdata->{prereqs}; |
42
|
1
|
|
|
|
|
4
|
for my $phase (keys %{ $prereqs }) { |
|
1
|
|
|
|
|
5
|
|
43
|
1
|
|
|
|
|
4
|
for my $type (keys %{ $prereqs->{$phase} }) { |
|
1
|
|
|
|
|
4
|
|
44
|
|
|
|
|
|
|
$self->zilla->register_prereqs( |
45
|
|
|
|
|
|
|
{ phase => $phase, type => $type }, |
46
|
1
|
|
|
|
|
34
|
%{ $prereqs->{$phase}{$type} } |
|
1
|
|
|
|
|
20
|
|
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#ABSTRACT: Add arbitrary metadata using a mergefile |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Dist::Zilla::Plugin::MetaMergeFile - Add arbitrary metadata using a mergefile |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 VERSION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
version 0.002 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head3 dist.ini: |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
[MetaMergeFile] |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head3 metamerge.yml |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
prereqs: |
81
|
|
|
|
|
|
|
runtime: |
82
|
|
|
|
|
|
|
recommends: |
83
|
|
|
|
|
|
|
Foo: 0.023 |
84
|
|
|
|
|
|
|
suggests: |
85
|
|
|
|
|
|
|
Bar: 0 |
86
|
|
|
|
|
|
|
resources |
87
|
|
|
|
|
|
|
homepage: http://www.example.com/MyModule/ |
88
|
|
|
|
|
|
|
x_twitter: http://twitter.com/cpan_linked/ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 DESCRIPTION |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This plugin implements metamerge files. These allow you to easily add arbitrary information to your metafiles. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 Why metamerge files? |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Metamerge files are somewhat similar to cpanfiles, but with a few important differences. Firstly, they're not limited to prereqs but allow any valid type of metadata. Secondly, they don't involve evaluating code to produce data, data should be data. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 Names and formats |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This file reads either a JSON formatted F<metamerge.json>, or a YAML formatted F<metamerge.yml> (or another file if passed with the C<filename> parameter). Regardless of the format, it will parse them as L<META 2.0|CPAN::Meta::Spec> unless their C<meta-spec> field claims otherwise. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Leon Timmermans. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |