line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Pods2Site::Pod2HTML; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
49
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
109
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003'; |
7
|
|
|
|
|
|
|
my $version = $VERSION; |
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
10
|
use App::Pods2Site::Util qw(slashify createSpinner); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
124
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use File::Basename; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
114
|
|
13
|
2
|
|
|
2
|
|
12
|
use File::Path qw(make_path); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
14
|
2
|
|
|
2
|
|
884
|
use Pod::Html; |
|
2
|
|
|
|
|
19370
|
|
|
2
|
|
|
|
|
1027
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# CTOR |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
sub new |
19
|
|
|
|
|
|
|
{ |
20
|
3
|
|
|
3
|
0
|
10
|
my $class = shift; |
21
|
3
|
|
|
|
|
4
|
my $args = shift; |
22
|
3
|
|
|
|
|
5
|
my $podRoot = shift; |
23
|
3
|
|
|
|
|
6
|
my $workGroups = shift; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
34
|
my $self = bless( { generated => 0, uptodate => 0 }, $class); |
26
|
3
|
|
|
|
|
49
|
$self->__updateHTML($args, $podRoot, $workGroups); |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
36
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getGenerated |
32
|
|
|
|
|
|
|
{ |
33
|
3
|
|
|
3
|
0
|
10
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
21
|
return $self->{generated}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub getUptodate |
39
|
|
|
|
|
|
|
{ |
40
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
147
|
return $self->{uptodate}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# PRIVATE |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub __updateHTML |
49
|
|
|
|
|
|
|
{ |
50
|
3
|
|
|
3
|
|
6
|
my $self = shift; |
51
|
3
|
|
|
|
|
6
|
my $args = shift; |
52
|
3
|
|
|
|
|
6
|
my $podRoot = shift; |
53
|
3
|
|
|
|
|
4
|
my $workGroups = shift; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# get the work tree pod root, and create a podpath |
56
|
|
|
|
|
|
|
# |
57
|
3
|
|
|
|
|
4
|
my @sections; |
58
|
3
|
|
|
|
|
22
|
push(@sections, $_->{group}) foreach (@$workGroups); |
59
|
3
|
|
|
|
|
18
|
my $podpath = join(':', @sections); |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
12
|
my $spinner = createSpinner($args); |
62
|
|
|
|
|
|
|
|
63
|
3
|
|
|
|
|
7
|
my $count = 0; |
64
|
3
|
|
|
|
|
17
|
foreach my $workGroup (@$workGroups) |
65
|
|
|
|
|
|
|
{ |
66
|
6
|
|
|
|
|
13
|
foreach my $podName (keys(%{$workGroup->{podinfo}})) |
|
6
|
|
|
|
|
29
|
|
67
|
|
|
|
|
|
|
{ |
68
|
10
|
|
|
|
|
16
|
$count++; |
69
|
|
|
|
|
|
|
|
70
|
10
|
|
|
|
|
33
|
my $podfile = $workGroup->{podinfo}->{$podName}->{podfile}; |
71
|
|
|
|
|
|
|
|
72
|
10
|
|
|
|
|
26
|
my $outfile = $podfile; |
73
|
10
|
|
|
|
|
154
|
$outfile =~ s/^\Q$podRoot\E.//; |
74
|
10
|
|
|
|
|
84
|
$outfile =~ s/\.[^.]+$//; |
75
|
10
|
|
|
|
|
50
|
$outfile = slashify($outfile, '/'); |
76
|
|
|
|
|
|
|
|
77
|
10
|
|
50
|
|
|
38
|
my $htmlroot = ('..' x ($outfile =~ tr#/##)) || '.'; |
78
|
10
|
|
|
|
|
28
|
$htmlroot =~ s#\.\.(?=\.)#../#g; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# place all pod2html generated files in the pod2html dir |
81
|
|
|
|
|
|
|
# |
82
|
10
|
|
|
|
|
27
|
my $relOutFile = "pod2html/$outfile.html"; |
83
|
10
|
|
|
|
|
54
|
$outfile = slashify($args->getSiteDir() . "/$relOutFile"); |
84
|
|
|
|
|
|
|
|
85
|
10
|
|
|
|
|
22
|
$workGroup->{podinfo}->{$podName}->{htmlfile} = $outfile; |
86
|
|
|
|
|
|
|
|
87
|
10
|
|
|
|
|
139
|
my $mtimePodfile = (stat($podfile))[9]; |
88
|
10
|
|
100
|
|
|
170
|
my $mtimeOutfile = (stat($outfile))[9] || 0; |
89
|
|
|
|
|
|
|
|
90
|
10
|
100
|
66
|
|
|
117
|
if (!-e $outfile || $mtimePodfile > $mtimeOutfile) |
91
|
|
|
|
|
|
|
{ |
92
|
7
|
|
|
|
|
294
|
my $outfileDir = dirname($outfile); |
93
|
7
|
100
|
|
|
|
916
|
(!-d $outfileDir ? make_path($outfileDir) : 1) || die ("Failed to create directory '$outfileDir': $!\n"); |
|
|
50
|
|
|
|
|
|
94
|
7
|
50
|
|
|
|
57
|
my @p2hargs = |
95
|
|
|
|
|
|
|
( |
96
|
|
|
|
|
|
|
"--infile=$podfile", |
97
|
|
|
|
|
|
|
"--outfile=$outfile", |
98
|
|
|
|
|
|
|
"--podroot=$podRoot", |
99
|
|
|
|
|
|
|
$podpath ? ("--podpath=$podpath") : (), |
100
|
|
|
|
|
|
|
"--htmlroot=$htmlroot", |
101
|
|
|
|
|
|
|
"--css=$htmlroot/../pods2site.css", |
102
|
|
|
|
|
|
|
); |
103
|
7
|
50
|
|
|
|
29
|
if (!$args->isVerboseLevel(2)) |
104
|
|
|
|
|
|
|
{ |
105
|
7
|
|
|
|
|
14
|
push(@p2hargs, '--quiet'); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
else |
108
|
|
|
|
|
|
|
{ |
109
|
0
|
0
|
|
|
|
0
|
push(@p2hargs, '--verbose') if $args->isVerboseLevel(3); |
110
|
|
|
|
|
|
|
} |
111
|
7
|
|
|
|
|
63
|
pod2html(@p2hargs); |
112
|
|
|
|
|
|
|
|
113
|
7
|
|
|
|
|
49131
|
$self->{generated}++; |
114
|
|
|
|
|
|
|
|
115
|
7
|
50
|
|
|
|
56
|
$args->isVerboseLevel(1) |
116
|
|
|
|
|
|
|
? print "Generating '$outfile'...\n" |
117
|
|
|
|
|
|
|
: $spinner->($count); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
else |
120
|
|
|
|
|
|
|
{ |
121
|
3
|
|
|
|
|
17
|
$self->{uptodate}++; |
122
|
|
|
|
|
|
|
|
123
|
3
|
50
|
|
|
|
16
|
$args->isVerboseLevel(1) |
124
|
|
|
|
|
|
|
? print "Skipping uptodate '$outfile'\n" |
125
|
|
|
|
|
|
|
: $spinner->($count); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |