line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PrereqsFile; |
2
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::PrereqsFile::VERSION = '0.004'; |
3
|
1
|
|
|
1
|
|
81165
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
6090
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::PrereqSource/; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
95
|
use MooseX::Types::Moose 'ArrayRef'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
9
|
1
|
|
|
1
|
|
4156
|
use MooseX::Types::Stringlike 'Stringlike'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @defaults = qw/prereqs.json prereqs.yml/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has filenames => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => ArrayRef[Stringlike], |
16
|
|
|
|
|
|
|
default => sub { |
17
|
|
|
|
|
|
|
return [ grep { -f } @defaults ]; |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub register_prereqs { |
22
|
1
|
|
|
1
|
0
|
34865
|
my $self = shift; |
23
|
1
|
|
|
|
|
2
|
for my $filename (@{ $self->filenames }) { |
|
1
|
|
|
|
|
33
|
|
24
|
1
|
|
|
|
|
8
|
require Parse::CPAN::Meta; |
25
|
1
|
|
|
|
|
9
|
my $prereqs = Parse::CPAN::Meta->load_file($filename); |
26
|
1
|
|
|
|
|
466
|
for my $phase (keys %{ $prereqs }) { |
|
1
|
|
|
|
|
6
|
|
27
|
1
|
|
|
|
|
2
|
for my $type (keys %{ $prereqs->{$phase} }) { |
|
1
|
|
|
|
|
4
|
|
28
|
|
|
|
|
|
|
$self->zilla->register_prereqs( |
29
|
|
|
|
|
|
|
{ phase => $phase, type => $type }, |
30
|
1
|
|
|
|
|
31
|
%{ $prereqs->{$phase}{$type} } |
|
1
|
|
|
|
|
13
|
|
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub mvp_aliases { |
38
|
|
|
|
|
|
|
return { |
39
|
1
|
|
|
1
|
0
|
310
|
filename => 'filenames', |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#ABSTRACT: Add static prereqs using a prereqs file |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding UTF-8 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PrereqsFile - Add static prereqs using a prereqs file |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.004 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head3 dist.ini: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
[PrereqsFile] |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head3 prereqs.yml |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
runtime: |
72
|
|
|
|
|
|
|
recommends: |
73
|
|
|
|
|
|
|
Foo: 0.023 |
74
|
|
|
|
|
|
|
suggests: |
75
|
|
|
|
|
|
|
Bar: 0 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This plugin implements prereqs files. These allow you to easily add static prerequisites to your metadata. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 Why prereqs files? |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Prereqs files are somewhat similar to cpanfiles, but with an important difference. They don't involve evaluating code to produce data, data should be data. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 Names and formats |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This file reads either a JSON formatted F<prereqs.json>, and/or a YAML formatted F<prereqs.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> prereqs. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Leon Timmermans. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
98
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |