| 1 | package Dist::Zilla::Plugin::PrereqsFile; | ||
| 2 | 2 | $Dist::Zilla::Plugin::PrereqsFile::VERSION = '0.005'; | |
| 3 | 2 | ▶ | use 5.020; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use experimental qw/signatures postderef/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | with qw/Dist::Zilla::Role::PrereqSource/; | |
| 9 | |||
| 10 | 2 | ▶ | use MooseX::Types::Moose 'ArrayRef'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | use MooseX::Types::Stringlike 'Stringlike'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 2 | my @defaults = qw/prereqs.json prereqs.yml/; | |
| 14 | |||
| 15 | has filenames => ( | ||
| 16 | is => 'ro', | ||
| 17 | isa => ArrayRef[Stringlike], | ||
| 18 | 1 | ▶ | default => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 1 | return [ grep { -f } @defaults ]; | |
| 20 | }, | ||
| 21 | 2 | ); | |
| 22 | |||
| 23 | 1 | ▶ | sub register_prereqs($self) { |
|
Subroutine
register_prereqs: called CC=4 SCAR=13.9
Pod
undocumented
| |||
| 24 | 1 | for my $filename ($self->filenames->@*) { | |
| 25 | 1 | require Parse::CPAN::Meta; | |
| 26 | 1 | my $prereqs = Parse::CPAN::Meta->load_file($filename); | |
| 27 | 1 | for my $phase (keys $prereqs->%*) { | |
| 28 | 1 | for my $type (keys $prereqs->{$phase}->%*) { | |
| 29 | $self->zilla->register_prereqs( | ||
| 30 | { phase => $phase, type => $type }, | ||
| 31 | 1 | $prereqs->{$phase}{$type}->%* | |
| 32 | ); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | 1 | ▶ | sub mvp_aliases($self) { |
|
Subroutine
mvp_aliases: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 39 | return { | ||
| 40 | 1 | filename => 'filenames', | |
| 41 | }; | ||
| 42 | } | ||
| 43 | |||
| 44 | 2 | __PACKAGE__->meta->make_immutable; | |
| 45 | |||
| 46 | 2 | 1; | |
| 47 | |||
| 48 | #ABSTRACT: Add static prereqs using a prereqs file | ||
| 49 | |||
| 50 | __END__ | ||