| 1 | package Minilla::FileGatherer; | ||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use File::pushd; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 2 | ▶ | use File::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 2 | ▶ | use ExtUtils::Manifest 1.54 qw(maniskip); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 2 | ▶ | use Minilla::Git; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 2 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | has exclude_match => ( | ||||||||||||
| 14 | is => 'ro', | ||||||||||||
| 15 | 0 | ▶ | default => sub { +[ ] }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 16 | 2 | ); | |||||||||||
| 17 | |||||||||||||
| 18 | has include_dotfiles => ( | ||||||||||||
| 19 | is => 'ro', | ||||||||||||
| 20 | 0 | ▶ | default => sub { undef }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 21 | 2 | ); | |||||||||||
| 22 | |||||||||||||
| 23 | 2 | ▶ | no Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub gather_files { | ||||||||||
|
Subroutine
gather_files: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||
| 26 | 0 | my ($self, $root) = @_; | |||||||||||
| 27 | 0 | my $guard = pushd($root); | |||||||||||
| 28 | 0 | my @files = grep { _topdir($_) ne 'extlib' } | |||||||||||
| 29 | 0 | grep { not -l $_ } | |||||||||||
| 30 | 0 | map { File::Spec->abs2rel($_, $root) } | |||||||||||
| 31 | git_ls_files(), git_submodule_files(); | ||||||||||||
| 32 | 0 | ▶ | if ($self->exclude_match) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 0 | ▶ | for my $pattern (@{$self->exclude_match || []}) { | ||||||||||
|
Condition0%0/2
$self->exclude_match || []
MC/DC0%0/1
$self->exclude_match || []
$self->exclude_match
Truth table0%0/2
A
A= $self->exclude_match
| |||||||||||||
| 34 | 0 | @files = grep { _normalize($_) !~ $pattern } @files; | |||||||||||
| 35 | } | ||||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | ▶ | if (-f 'MANIFEST.SKIP') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 0 | my $skip = maniskip('MANIFEST.SKIP') ; | |||||||||||
| 40 | 0 | @files = grep { !$skip->($_) } @files; | |||||||||||
| 41 | } | ||||||||||||
| 42 | 0 | ▶ | unless ($self->include_dotfiles) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | @files = grep { | ||||||||||||
| 44 | 0 | !(grep { $_ =~ qr/^\./ } split m!/!, _normalize($_)) | |||||||||||
| 45 | } @files; | ||||||||||||
| 46 | } | ||||||||||||
| 47 | 0 | ▶ | if ($^O eq 'MSWin32') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 48 | @files = map { | ||||||||||||
| 49 | 0 | my $x = $_; | |||||||||||
| 50 | 0 | $x =~ s!\\!/!g; | |||||||||||
| 51 | 0 | $x; | |||||||||||
| 52 | } @files; | ||||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | 0 | my @submodules = git_submodules; | |||||||||||
| 56 | 0 | ▶ | if (@submodules) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 57 | 0 | for my $filename (@submodules) { | |||||||||||
| 58 | 0 | @files = grep { $_ ne $filename } @files; | |||||||||||
| 59 | } | ||||||||||||
| 60 | } | ||||||||||||
| 61 | |||||||||||||
| 62 | 0 | return @files; | |||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | 0 | ▶ | sub _topdir { | ||||||||||
|
Subroutine
_topdir: not called CC=2 SCAR=17.9
| |||||||||||||
| 66 | 0 | my ($path) = @_; | |||||||||||
| 67 | 0 | ▶ | [File::Spec->splitdir($path)]->[0] || ''; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | # for Windows | ||||||||||||
| 71 | 0 | ▶ | sub _normalize { | ||||||||||
|
Subroutine
_normalize: not called CC=1 SCAR=6.9
| |||||||||||||
| 72 | 0 | local $_ = shift; | |||||||||||
| 73 | 0 | s!\\!/!g; | |||||||||||
| 74 | 0 | $_; | |||||||||||
| 75 | } | ||||||||||||
| 76 | |||||||||||||
| 77 | 2 | 1; | |||||||||||