line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::JsonAPI::Autodoc::Path; |
2
|
14
|
|
|
14
|
|
25525
|
use strict; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
773
|
|
3
|
14
|
|
|
14
|
|
75
|
use warnings; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
345
|
|
4
|
14
|
|
|
14
|
|
84
|
use utf8; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
104
|
|
5
|
14
|
|
|
14
|
|
334
|
use Carp; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
986
|
|
6
|
14
|
|
|
14
|
|
18054
|
use FindBin; |
|
14
|
|
|
|
|
16618
|
|
|
14
|
|
|
|
|
827
|
|
7
|
14
|
|
|
14
|
|
3127
|
use Path::Tiny; |
|
14
|
|
|
|
|
34719
|
|
|
14
|
|
|
|
|
842
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
|
83
|
use constant end_condition_file => 'cpanfile'; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
6482
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub find_project_root_path { |
12
|
1
|
|
|
1
|
0
|
15
|
my $class = shift; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
8
|
my $path = path($FindBin::Bin); |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
47
|
my %paths; |
17
|
|
|
|
|
|
|
my $project_root_path; |
18
|
1
|
|
|
|
|
2
|
while (1) { |
19
|
2
|
100
|
|
|
|
45
|
if (-f $path->child(end_condition_file)) { |
20
|
1
|
|
|
|
|
47
|
$project_root_path = $path; |
21
|
1
|
|
|
|
|
3
|
last; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
118
|
my $abs_path = $path->absolute; |
25
|
1
|
50
|
|
|
|
52
|
if ($paths{$abs_path}) { |
26
|
0
|
|
|
|
|
0
|
croak '! cpanfile is not found. Please put cpanfile on a project root.'; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
8
|
$paths{$abs_path}++; |
30
|
1
|
|
|
|
|
10
|
$path = $path->parent; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
6
|
return $project_root_path; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub document_path { |
37
|
13
|
|
|
13
|
0
|
32
|
my ($class, $output_path) = @_; |
38
|
|
|
|
|
|
|
|
39
|
13
|
|
|
|
|
83
|
(my $document_name = $FindBin::Script) =~ s/\.t$//; |
40
|
13
|
|
|
|
|
42
|
my $markdown_file = "$document_name.md"; |
41
|
|
|
|
|
|
|
|
42
|
13
|
|
|
|
|
26
|
my $document_path; |
43
|
13
|
50
|
|
|
|
280
|
if ($output_path) { |
44
|
13
|
50
|
|
|
|
112
|
if ($output_path =~ m!^~?/!) { |
45
|
|
|
|
|
|
|
# Absolute path |
46
|
13
|
|
|
|
|
178
|
$document_path = path($output_path)->child($markdown_file); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
|
|
|
|
|
|
# Relative path |
50
|
0
|
|
|
|
|
0
|
$document_path = path($FindBin::Bin)->child("$output_path/$markdown_file"); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else { |
54
|
|
|
|
|
|
|
# Default |
55
|
0
|
|
|
|
|
0
|
my $project_root_path = __PACKAGE__->find_project_root_path; |
56
|
0
|
|
|
|
|
0
|
$document_path = $project_root_path->child("docs/$markdown_file"); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
13
|
|
|
|
|
1225
|
$document_path->touchpath; |
60
|
|
|
|
|
|
|
|
61
|
13
|
|
|
|
|
5993
|
return $document_path; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |