| 1 | package Dist::Zilla::Plugin::MakeMaker::IncShareDir; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use 5.008_005; | ||
| 5 | our $VERSION = '0.01'; | ||
| 6 | |||
| 7 | use Moose; | ||
| 8 | extends 'Dist::Zilla::Plugin::MakeMaker'; | ||
| 9 | with 'Dist::Zilla::Role::ModuleIncluder', 'Dist::Zilla::Role::FileGatherer'; | ||
| 10 | |||
| 11 | sub gather_files { | ||
| 12 | my $self = shift; | ||
| 13 | $self->include_modules([ 'File::ShareDir::Install' ], version->new('5.008001')); | ||
| 14 | } | ||
| 15 | |||
| 16 | after register_prereqs => sub { | ||
| 17 | my $self = shift; | ||
| 18 | $self->zilla->prereqs->requirements_for('configure', 'requires')->clear_requirement('File::ShareDir::Install'); | ||
| 19 | }; | ||
| 20 | |||
| 21 | override share_dir_code => sub { | ||
| 22 | my $self = shift; | ||
| 23 | |||
| 24 | my $code = super; | ||
| 25 | $code->{preamble} = "use lib 'inc';\n$code->{preamble}"; | ||
| 26 | $code; | ||
| 27 | }; | ||
| 28 | |||
| 29 | 1; | ||
| 30 | __END__ |