Browse files

fixes #216

  • Loading branch information...
1 parent b96e0dc commit 5e07edcecd2fe580da42bc48b2aaf6b7640f6175 @monken monken committed Mar 16, 2013
Showing with 19 additions and 0 deletions.
  1. +6 −0 lib/MetaCPAN/Document/Release.pm
  2. +8 −0 lib/MetaCPAN/Script/Release.pm
  3. +5 −0 t/release/multiple-modules.t
View
6 lib/MetaCPAN/Document/Release.pm
@@ -93,8 +93,14 @@ and C<mtime>.
B<Boolean>; Indicates whether this is the first ever release for this distribution.
+=head2 provides
+
+This is an ArrayRef of modules that are included in this release.
+
=cut
+has provides => ( isa => 'ArrayRef[Str]', is => 'rw' );
+
has id => ( is => 'ro', id => [qw(author name)] );
has [qw(license version author archive)] => ( is => 'ro', required => 1 );
has date => ( is => 'ro', required => 1, isa => 'DateTime' );
View
8 lib/MetaCPAN/Script/Release.pm
@@ -336,12 +336,16 @@ sub import_tarball {
log_debug { "Indexing ", scalar @modules, " modules" };
my $perms = $self->perms;
my @release_unauthorized;
+ my @provides;
foreach my $file (@modules) {
$_->set_associated_pod( $file, \%associated_pod )
for ( @{ $file->module } );
$file->set_indexed($meta);
push( @release_unauthorized, $file->set_authorized($perms) )
if ( keys %$perms );
+ for(@{$file->module}) {
+ push(@provides, $_->name) if $_->indexed && $_->authorized;
+ }
$file->clear_module if ( $file->is_pod_file );
log_trace {"reindexing file $file->{path}"};
$bulk->put($file);
@@ -351,6 +355,10 @@ sub import_tarball {
$release->put;
}
}
+ if(@provides) {
+ $release->provides(\@provides);
+ $release->put;
+ }
$bulk->commit;
if (@release_unauthorized) {
View
5 t/release/multiple-modules.t
@@ -18,6 +18,11 @@ is( $release->name, 'Multiple-Modules-1.01', 'name ok' );
is( $release->author, 'LOCAL', 'author ok' );
+is_deeply(
+ $release->provides,
+ ["Multiple::Modules","Multiple::Modules::A","Multiple::Modules::A2","Multiple::Modules::B"],
+ 'provides ok' );
+
# This test depends on files being indexed in the right order
# which depends on the mtime of the files. Currently CPAN::Faker just
# generates them all at once and so file reading can be effectively

0 comments on commit 5e07edc

Please sign in to comment.