| 1 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package App::Embra::Plugin::GatherDir; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | $App::Embra::Plugin::GatherDir::VERSION = '0.001'; # TRIAL | |||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: gather all the files in a directory | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Path::Class::Dir; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use List::MoreUtils qw< any >; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Method::Signatures; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use App::Embra::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | method mvp_multivalue_args() { qw< exclude_match >; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
mvp_multivalue_args: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | has 'from' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 20 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | default => sub { '.' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | ▶ | coerce => sub { Path::Class::Dir->new( $_[0] )->absolute }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | has 'include_dotfiles' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 28 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | default => sub { !1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | has 'exclude_match' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 34 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | ▶ | coerce => sub { [ map { qr{$_} } @{ $_[0] } ] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | ▶ | method gather_files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
gather_files: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | $self->debug( 'looking in '.$self->from ); | |||||||||||||||||||||||||||||||||||||||||
| 41 | 35 | ▶ | $self->from->recurse( callback => func( $file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=24.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 35 | ▶ | return if $file eq $self->from; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 31 | ▶ | my $skip = $file->basename =~ m/ \A [.] /xms && not $self->include_dotfiles; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$file->basename =~ / \A [.] /msx && !$self->include_dotfiles
MC/DC100%2/2
$file->basename =~ / \A [.] /msx && !$self->include_dotfiles
$file->basename =~ / \A [.] /msx
!$self->include_dotfiles
Truth table100%3/3
A && not(B)
A= $file->basename =~ / \A [.] /msxB= !$self->include_dotfiles
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 31 | ▶ | my $exclude = any { $file =~ $_ } @{ $self->exclude_match }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 31 | ▶ | return $file->PRUNE if $file->is_dir and $skip || $exclude; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$file->is_dir and $skip || $exclude
$skip or $exclude
MC/DC100%3/3
$file->is_dir and $skip || $exclude
$file->is_dir
$skip
$exclude
Truth table100%4/4
A and B or C
A= $file->is_dirB= $skipC= $exclude
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 26 | ▶ | return if $file->is_dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 15 | $self->debug( "considering $file" ); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 15 | ▶ | return if $skip or $exclude; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$skip or $exclude
MC/DC50%1/2
$skip or $exclude
$skip
$exclude
Truth table66%2/3
A or B
A= $skipB= $exclude
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 12 | my $embra_file = App::Embra::File->new( name => $file->stringify ); | |||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | $embra_file->name( $file->relative( $self->from )->stringify ); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 12 | $self->add_file( $embra_file ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | } ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | with 'App::Embra::Role::FileGatherer'; | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||||||||||||||||||||||||