line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PRT::Collector::AllFiles; |
2
|
2
|
|
|
2
|
|
1094
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
42
|
|
3
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
33
|
|
4
|
2
|
|
|
2
|
|
860
|
use File::Find::Rule; |
|
2
|
|
|
|
|
10843
|
|
|
2
|
|
|
|
|
11
|
|
5
|
2
|
|
|
2
|
|
68
|
use Path::Class; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
662
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# find project root directory from specified directory path |
8
|
|
|
|
|
|
|
# If exists cpanfile on path, it is a project root. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# returns: |
11
|
|
|
|
|
|
|
# directory path (when found) |
12
|
|
|
|
|
|
|
# undef (when not found) |
13
|
|
|
|
|
|
|
sub find_project_root_directory { |
14
|
7
|
|
|
7
|
0
|
8756
|
my ($class, $directory) = @_; |
15
|
|
|
|
|
|
|
|
16
|
7
|
100
|
|
|
|
74
|
die "$directory does not exist" unless -d $directory; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
15
|
my $current = dir($directory); |
19
|
6
|
|
|
|
|
241
|
while (1) { |
20
|
11
|
100
|
|
|
|
193
|
if (-e $current->file('cpanfile')) { |
21
|
4
|
|
|
|
|
351
|
return $current->stringify; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
7
|
100
|
|
|
|
743
|
if ($current eq $current->parent) { |
25
|
|
|
|
|
|
|
# not found |
26
|
2
|
|
|
|
|
108
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
5
|
|
|
|
|
304
|
$current = $current->parent; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
34
|
5
|
|
|
5
|
0
|
6919
|
my ($class, $directory) = @_; |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
17
|
bless { |
37
|
|
|
|
|
|
|
directory => $directory, |
38
|
|
|
|
|
|
|
}, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub directory { |
42
|
7
|
|
|
7
|
0
|
804
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
186
|
$self->{directory}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub collect { |
48
|
2
|
|
|
2
|
0
|
39
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
2
|
100
|
|
|
|
3
|
die "directory @{[ $self->directory ]} does not exist" unless -d $self->directory; |
|
1
|
|
|
|
|
3
|
|
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
2
|
my @files = $self->_retrieve_all_perl_files; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
5
|
\@files; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _retrieve_all_perl_files { |
58
|
1
|
|
|
1
|
|
1
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
2
|
my @ignore_directories = qw(share fatlib _build .git blib local); |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
4
|
my $rule = File::Find::Rule->new; |
63
|
1
|
|
|
|
|
7
|
$rule = $rule->or($rule->new |
64
|
|
|
|
|
|
|
->directory |
65
|
|
|
|
|
|
|
->name(@ignore_directories) |
66
|
|
|
|
|
|
|
->prune |
67
|
|
|
|
|
|
|
->discard, |
68
|
|
|
|
|
|
|
$rule->new); |
69
|
1
|
|
|
|
|
491
|
my @files = $rule->file |
70
|
|
|
|
|
|
|
->name(qr/\.(?:pl|pm|psgi|t)\Z/) |
71
|
|
|
|
|
|
|
->in($self->directory); |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
1175
|
return @files; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |