line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::MetaYAML 6.030; |
2
|
|
|
|
|
|
|
# ABSTRACT: produce a META.yml |
3
|
|
|
|
|
|
|
|
4
|
11
|
|
|
11
|
|
8172
|
use Moose; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
104
|
|
5
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileGatherer'; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
78484
|
use Dist::Zilla::Pragmas; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
112
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
128
|
use Try::Tiny; |
|
11
|
|
|
|
|
45
|
|
|
11
|
|
|
|
|
1019
|
|
10
|
11
|
|
|
11
|
|
119
|
use namespace::autoclean; |
|
11
|
|
|
|
|
34
|
|
|
11
|
|
|
|
|
130
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod This plugin will add a F<META.yml> file to the distribution. |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod For more information on this file, see L<Module::Build::API> and L<CPAN::Meta>. |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod =attr filename |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod If given, parameter allows you to specify an alternate name for the generated |
21
|
|
|
|
|
|
|
#pod file. It defaults, of course, to F<META.yml>. |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod =cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has filename => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'Str', |
28
|
|
|
|
|
|
|
default => 'META.yml', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub gather_files { |
32
|
11
|
|
|
11
|
0
|
53
|
my ($self, $arg) = @_; |
33
|
|
|
|
|
|
|
|
34
|
11
|
|
|
|
|
525
|
require Dist::Zilla::File::FromCode; |
35
|
11
|
|
|
|
|
63
|
require YAML::Tiny; |
36
|
11
|
|
|
|
|
1519
|
require CPAN::Meta::Converter; |
37
|
11
|
|
|
|
|
35795
|
CPAN::Meta::Converter->VERSION(2.101550); # improved downconversion |
38
|
11
|
|
|
|
|
88
|
require CPAN::Meta::Validator; |
39
|
11
|
|
|
|
|
200
|
CPAN::Meta::Validator->VERSION(2.101550); # improved downconversion |
40
|
|
|
|
|
|
|
|
41
|
11
|
|
|
|
|
444
|
my $zilla = $self->zilla; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $file = Dist::Zilla::File::FromCode->new({ |
44
|
|
|
|
|
|
|
name => $self->filename, |
45
|
|
|
|
|
|
|
code_return_type => 'text', |
46
|
|
|
|
|
|
|
code => sub { |
47
|
11
|
|
|
11
|
|
302
|
my $distmeta = $zilla->distmeta; |
48
|
|
|
|
|
|
|
|
49
|
11
|
|
|
|
|
149
|
my $validator = CPAN::Meta::Validator->new($distmeta); |
50
|
|
|
|
|
|
|
|
51
|
11
|
50
|
|
|
|
282
|
unless ($validator->is_valid) { |
52
|
0
|
|
|
|
|
0
|
my $msg = "Invalid META structure. Errors found:\n"; |
53
|
0
|
|
|
|
|
0
|
$msg .= join( "\n", $validator->errors ); |
54
|
0
|
|
|
|
|
0
|
$self->log_fatal($msg); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
11
|
|
|
|
|
9108
|
my $converter = CPAN::Meta::Converter->new($distmeta); |
58
|
11
|
|
|
|
|
520
|
my $output = $converter->convert(version => '1.4'); |
59
|
11
|
|
|
|
|
18527
|
$output->{x_serialization_backend} = sprintf '%s version %s', |
60
|
|
|
|
|
|
|
'YAML::Tiny', YAML::Tiny->VERSION; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $yaml = try { |
63
|
11
|
|
|
|
|
722
|
YAML::Tiny->new($output)->write_string; # text! |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
catch { |
66
|
0
|
|
|
|
|
0
|
$self->log_fatal("Could not create YAML string: " . YAML::Tiny->errstr) |
67
|
11
|
|
|
|
|
153
|
}; |
68
|
11
|
|
|
|
|
16952
|
return $yaml; |
69
|
|
|
|
|
|
|
}, |
70
|
11
|
|
|
|
|
380
|
}); |
71
|
|
|
|
|
|
|
|
72
|
11
|
|
|
|
|
85
|
$self->add_file($file); |
73
|
11
|
|
|
|
|
95
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
80
|
|
|
|
|
|
|
#pod |
81
|
|
|
|
|
|
|
#pod Core Dist::Zilla plugins: |
82
|
|
|
|
|
|
|
#pod L<@Basic|Dist::Zilla::PluginBundle::Basic>, |
83
|
|
|
|
|
|
|
#pod L<Manifest|Dist::Zilla::Plugin::Manifest>. |
84
|
|
|
|
|
|
|
#pod |
85
|
|
|
|
|
|
|
#pod Dist::Zilla roles: |
86
|
|
|
|
|
|
|
#pod L<FileGatherer|Dist::Zilla::Role::FileGatherer>. |
87
|
|
|
|
|
|
|
#pod |
88
|
|
|
|
|
|
|
#pod Other modules: |
89
|
|
|
|
|
|
|
#pod L<CPAN::Meta>, |
90
|
|
|
|
|
|
|
#pod L<CPAN::Meta::Spec>, L<YAML>. |
91
|
|
|
|
|
|
|
#pod |
92
|
|
|
|
|
|
|
#pod =cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding UTF-8 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Dist::Zilla::Plugin::MetaYAML - produce a META.yml |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 VERSION |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
version 6.030 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This plugin will add a F<META.yml> file to the distribution. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
For more information on this file, see L<Module::Build::API> and L<CPAN::Meta>. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 PERL VERSION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
117
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
118
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
119
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
122
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
123
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
124
|
|
|
|
|
|
|
the minimum required perl. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 filename |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
If given, parameter allows you to specify an alternate name for the generated |
131
|
|
|
|
|
|
|
file. It defaults, of course, to F<META.yml>. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SEE ALSO |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Core Dist::Zilla plugins: |
136
|
|
|
|
|
|
|
L<@Basic|Dist::Zilla::PluginBundle::Basic>, |
137
|
|
|
|
|
|
|
L<Manifest|Dist::Zilla::Plugin::Manifest>. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Dist::Zilla roles: |
140
|
|
|
|
|
|
|
L<FileGatherer|Dist::Zilla::Role::FileGatherer>. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Other modules: |
143
|
|
|
|
|
|
|
L<CPAN::Meta>, |
144
|
|
|
|
|
|
|
L<CPAN::Meta::Spec>, L<YAML>. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This software is copyright (c) 2023 by Ricardo SIGNES. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
155
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |