From: Graham Knop Date: Tue, 17 May 2016 11:13:14 +0000 (-0400) Subject: include provides metadata X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9b5ed238703b01cf8ffda409028cc4072a4d65f;p=p5sagit%2FDistar.git include provides metadata --- diff --git a/lib/Distar.pm b/lib/Distar.pm index fb4db68..0407ca1 100644 --- a/lib/Distar.pm +++ b/lib/Distar.pm @@ -159,6 +159,21 @@ sub _clone { ]; }; + if ( eval { require CPAN::Meta; require Module::Metadata; } ) { + $meta->{provides} ||= do { + my $meta_obj = CPAN::Meta->new($meta, { lazy_validation => 1 }); + my @files = `git ls-files`; + chomp @files; + my $provides = Module::Metadata->package_versions_from_directory('.', \@files); + for my $module (keys %$provides) { + delete $provides->{$module} + unless $meta_obj->should_index_package($module) + && $meta_obj->should_index_file($provides->{$module}{file}); + } + $provides; + }; + } + %$meta; }