line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::ProjectDocs::DocManager; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
30
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
125
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
229
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.53'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
23
|
use Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
26
|
|
9
|
4
|
|
|
4
|
|
24962
|
use Carp(); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
70
|
|
10
|
4
|
|
|
4
|
|
20
|
use File::Find; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
255
|
|
11
|
4
|
|
|
4
|
|
2009
|
use IO::File; |
|
4
|
|
|
|
|
32326
|
|
|
4
|
|
|
|
|
514
|
|
12
|
4
|
|
|
4
|
|
1856
|
use Pod::ProjectDocs::Doc; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
2538
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'config' => ( is => 'ro', ); |
15
|
|
|
|
|
|
|
has 'desc' => ( |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
isa => 'Str', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
has 'suffix' => ( is => 'rw', ); |
20
|
|
|
|
|
|
|
has 'parser' => ( is => 'ro', ); |
21
|
|
|
|
|
|
|
has 'docs' => ( |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
isa => 'ArrayRef', |
24
|
|
|
|
|
|
|
default => sub { [] }, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub BUILD { |
28
|
9
|
|
|
9
|
0
|
8845
|
my $self = shift; |
29
|
9
|
|
|
|
|
34
|
$self->_find_files(); |
30
|
9
|
|
|
|
|
25
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _find_files { |
34
|
9
|
|
|
9
|
|
15
|
my $self = shift; |
35
|
9
|
|
|
|
|
15
|
foreach my $dir ( @{ $self->config->libroot } ) { |
|
9
|
|
|
|
|
271
|
|
36
|
9
|
50
|
33
|
|
|
345
|
unless ( -e $dir && -d _ ) { |
37
|
0
|
|
|
|
|
0
|
Carp::croak(qq/$dir isn't detected or it's not a directory./); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
9
|
|
|
|
|
306
|
my $suffixs = $self->suffix; |
41
|
9
|
100
|
|
|
|
31
|
$suffixs = [$suffixs] if !ref $suffixs; |
42
|
9
|
|
|
|
|
15
|
foreach my $dir ( @{ $self->config->libroot } ) { |
|
9
|
|
|
|
|
222
|
|
43
|
9
|
|
|
|
|
20
|
foreach my $suffix (@$suffixs) { |
44
|
|
|
|
|
|
|
my $wanted = sub { |
45
|
40
|
100
|
|
40
|
|
2157
|
return unless $File::Find::name =~ /\.$suffix$/; |
46
|
5
|
|
|
|
|
18
|
( my $path = $File::Find::name ) =~ s#^\\.##; |
47
|
5
|
|
|
|
|
332
|
my ( $fname, $fdir ) = |
48
|
|
|
|
|
|
|
File::Basename::fileparse( $path, qr/\.$suffix/ ); |
49
|
5
|
|
|
|
|
436
|
my $reldir = File::Spec->abs2rel( $fdir, $dir ); |
50
|
5
|
|
33
|
|
|
20
|
$reldir ||= File::Spec->curdir; |
51
|
5
|
|
|
|
|
28
|
my $relpath = File::Spec->catdir( $reldir, $fname ); |
52
|
5
|
|
|
|
|
23
|
$relpath .= "."; |
53
|
5
|
|
|
|
|
50
|
$relpath .= $suffix; |
54
|
5
|
50
|
|
|
|
26
|
$relpath =~ s:\\:/:g if $^O eq 'MSWin32'; |
55
|
5
|
|
|
|
|
8
|
my $matched = 0; |
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
9
|
foreach my $regex ( @{ $self->config->except } ) { |
|
5
|
|
|
|
|
160
|
|
58
|
2
|
50
|
|
|
|
8
|
if ( $relpath =~ /$regex/ ) { |
59
|
0
|
|
|
|
|
0
|
$matched = 1; |
60
|
0
|
|
|
|
|
0
|
last; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# check if there is actually any POD inside, skip otherwise |
65
|
5
|
|
|
|
|
35
|
my $content = join( '', |
66
|
|
|
|
|
|
|
IO::File->new( $File::Find::name, 'r' )->getlines() ); |
67
|
5
|
50
|
|
|
|
1294
|
$matched = 1 if $content !~ m{^=(head1|head2|item|cut)}ismxg; |
68
|
|
|
|
|
|
|
|
69
|
5
|
50
|
|
|
|
20
|
unless ($matched) { |
70
|
5
|
|
|
|
|
8
|
push @{ $self->docs }, |
|
5
|
|
|
|
|
157
|
|
71
|
|
|
|
|
|
|
Pod::ProjectDocs::Doc->new( |
72
|
|
|
|
|
|
|
config => $self->config, |
73
|
|
|
|
|
|
|
origin => $path, |
74
|
|
|
|
|
|
|
origin_root => $dir, |
75
|
|
|
|
|
|
|
suffix => $suffix, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
12
|
|
|
|
|
78
|
}; |
79
|
12
|
|
|
|
|
1025
|
File::Find::find( { no_chdir => 1, wanted => $wanted }, $dir ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
9
|
|
|
|
|
136
|
$self->docs( [ sort { $a->name cmp $b->name } @{ $self->docs } ] ); |
|
1
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
433
|
|
83
|
9
|
|
|
|
|
22
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
4
|
|
|
4
|
|
41
|
no Moose; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
26
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
__END__ |