Commit | Line | Data |
b7838518 |
1 | package inc::RequireAuthorDeps; |
2 | |
b5ae7c00 |
3 | use Class::Load qw(load_class); |
b7838518 |
4 | use Moose; |
5 | |
1ebf2c00 |
6 | use CPAN::Meta::Requirements; |
b7838518 |
7 | use Try::Tiny; |
8 | |
9 | with 'Dist::Zilla::Role::BeforeRelease'; |
10 | |
11 | sub before_release { |
12 | my $self = shift; |
13 | |
14 | $self->log("Ensuring all author dependencies are installed"); |
1ebf2c00 |
15 | my $req = CPAN::Meta::Requirements->new; |
b7838518 |
16 | my $prereqs = $self->zilla->prereqs; |
17 | |
18 | for my $phase (qw(build test configure runtime develop)) { |
19 | $req->add_requirements($prereqs->requirements_for($phase, 'requires')); |
20 | } |
21 | |
22 | for my $mod (grep { $_ ne 'perl' } $req->required_modules) { |
b5ae7c00 |
23 | load_class($mod); |
b7838518 |
24 | } |
25 | } |
26 | |
27 | 1; |