diff --git a/Changes b/Changes index 3d47855..2b11182 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,10 @@ Revision history for Dist-Zilla-Plugin-Prereqs-AuthorDeps {{$NEXT}} + [CHANGED] + + - plugins that exist in the local build root are not added as prereqs. + 0.006 2016-05-02 11:06:55-04:00 America/New_York [CHANGED] diff --git a/corpus/DZ/dist.ini b/corpus/DZ/dist.ini index cf41e7c..f1c6f2f 100644 --- a/corpus/DZ/dist.ini +++ b/corpus/DZ/dist.ini @@ -19,4 +19,6 @@ exclude = Dist::Zilla::Plugin::RemovePrereqs [RemovePrereqs] remove = MostlyHarmless +[=inc::Foo] + ; authordep Devel::Foo = 0.123 diff --git a/corpus/DZ/inc/Foo.pm b/corpus/DZ/inc/Foo.pm new file mode 100644 index 0000000..9f03a9a --- /dev/null +++ b/corpus/DZ/inc/Foo.pm @@ -0,0 +1,5 @@ +package inc::Foo; +use Moose; +with 'Dist::Zilla::Role::BeforeBuild'; +sub before_build { 1 } +1; diff --git a/lib/Dist/Zilla/Plugin/Prereqs/AuthorDeps.pm b/lib/Dist/Zilla/Plugin/Prereqs/AuthorDeps.pm index 86e35cf..d176c4e 100644 --- a/lib/Dist/Zilla/Plugin/Prereqs/AuthorDeps.pm +++ b/lib/Dist/Zilla/Plugin/Prereqs/AuthorDeps.pm @@ -9,6 +9,7 @@ our $VERSION = '0.007'; use Moose; use MooseX::Types::Moose qw( HashRef ArrayRef Str ); use List::Util qw/min/; +use Path::Tiny; use Dist::Zilla::Util::AuthorDeps 5.021; use Dist::Zilla 4; @@ -81,6 +82,10 @@ sub register_prereqs { for my $req (@$authordeps) { my ( $mod, $version ) = each %$req; next if $self->_exclude_hash->{$mod}; + + (my $filename = $mod) =~ s{::}{/}g; + next if path($self->zilla->root, $filename.'.pm')->exists; + $zilla->register_prereqs( { phase => $phase, type => $relation }, $mod, $version ); }