Skip to content

Commit

Permalink
Merge a580982 into 141117f
Browse files Browse the repository at this point in the history
  • Loading branch information
andreeap committed Feb 18, 2015
2 parents 141117f + a580982 commit 15ba5c5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/MetaCPAN/Document/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ has metadata => (
source_only => 1,
);

has changes_file => (
is => 'rw',
isa => 'Str',
required => 0,
);

sub _build_version_numified {
return MetaCPAN::Util::numify_version( shift->version );
}
Expand Down
21 changes: 21 additions & 0 deletions lib/MetaCPAN/Script/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ sub import_tarball {
);
$bulk->commit;

$release->changes_file( $self->set_changes_file( \@files ) );

log_debug {'Gathering modules'};

# build module -> pod file mapping
Expand Down Expand Up @@ -490,6 +492,25 @@ sub import_tarball {
}
}

sub set_changes_file {
my $self = shift;
my @files = @{ $_[0] };

my @changes_files = qw(
Changelog
ChangeLog
CHANGELOG
Changes
CHANGES
NEWS
);

foreach my $file (@files) {
return $file->name if grep { $_ eq $file->name } @changes_files;
}

}

sub load_meta_file {
my ( $self, $dir ) = @_;
my @files;
Expand Down
7 changes: 4 additions & 3 deletions t/release/file-changes.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ my $release = $idx->type('release')->get(
}
);

is( $release->name, 'File-Changes-1.0', 'name ok' );
is( $release->author, 'LOCAL', 'author ok' );
is( $release->version, '1.0', 'version ok' );
is( $release->name, 'File-Changes-1.0', 'name ok' );
is( $release->author, 'LOCAL', 'author ok' );
is( $release->version, '1.0', 'version ok' );
is( $release->changes_file, 'Changes', 'changes_file ok' );

{
my @files
Expand Down

0 comments on commit 15ba5c5

Please sign in to comment.