Skip to content

Commit

Permalink
Move logic for default File "indexed" to lazy builder
Browse files Browse the repository at this point in the history
The CPAN::Meta object being used to set the old default was being passed in
anyway.  This makes it much easier to add additional logic and seems like a
less confusing place to have it.
  • Loading branch information
rwstauner committed Mar 30, 2015
1 parent 958d952 commit b6889ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 7 additions & 1 deletion lib/MetaCPAN/Document/File.pm
Expand Up @@ -300,7 +300,13 @@ has indexed => (
required => 1,
is => 'rw',
isa => 'Bool',
default => 1,
lazy => 1,
default => sub {
my ($self) = @_;
return 0 if $self->is_in_other_files;
return 0 if !$self->metadata->should_index_file( $self->path );
return 1;
},
);

=head2 level
Expand Down
4 changes: 1 addition & 3 deletions lib/MetaCPAN/Model/Release.pm
Expand Up @@ -245,9 +245,7 @@ sub _build_files {
date => $self->date,
directory => $child->is_dir,
distribution => $self->distribution,
indexed => $self->metadata->should_index_file($fpath)
? 1
: 0,

local_path => $child,
maturity => $self->maturity,
metadata => $self->metadata,
Expand Down
2 changes: 0 additions & 2 deletions t/release/common-files.t
Expand Up @@ -5,8 +5,6 @@ use warnings;
use lib 't/lib';
use MetaCPAN::TestHelpers;

local $TODO = 'FIXME';

test_release(
{
name => 'Common-Files-1.1',
Expand Down

0 comments on commit b6889ff

Please sign in to comment.