| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::JsonAPI::Autodoc::Path; |
|
2
|
15
|
|
|
15
|
|
16066
|
use strict; |
|
|
15
|
|
|
|
|
21
|
|
|
|
15
|
|
|
|
|
459
|
|
|
3
|
15
|
|
|
15
|
|
55
|
use warnings; |
|
|
15
|
|
|
|
|
16
|
|
|
|
15
|
|
|
|
|
328
|
|
|
4
|
15
|
|
|
15
|
|
61
|
use utf8; |
|
|
15
|
|
|
|
|
17
|
|
|
|
15
|
|
|
|
|
68
|
|
|
5
|
15
|
|
|
15
|
|
246
|
use Carp; |
|
|
15
|
|
|
|
|
25
|
|
|
|
15
|
|
|
|
|
729
|
|
|
6
|
15
|
|
|
15
|
|
6083
|
use FindBin; |
|
|
15
|
|
|
|
|
11311
|
|
|
|
15
|
|
|
|
|
557
|
|
|
7
|
15
|
|
|
15
|
|
1467
|
use Path::Tiny; |
|
|
15
|
|
|
|
|
20942
|
|
|
|
15
|
|
|
|
|
703
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
15
|
|
|
15
|
|
68
|
use constant end_condition_file => 'cpanfile'; |
|
|
15
|
|
|
|
|
18
|
|
|
|
15
|
|
|
|
|
4886
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub find_project_root_path { |
|
12
|
1
|
|
|
1
|
0
|
9
|
my $class = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
4
|
my $path = path($FindBin::Bin); |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
31
|
my %paths; |
|
17
|
|
|
|
|
|
|
my $project_root_path; |
|
18
|
1
|
|
|
|
|
2
|
while (1) { |
|
19
|
2
|
100
|
|
|
|
36
|
if (-f $path->child(end_condition_file)) { |
|
20
|
1
|
|
|
|
|
30
|
$project_root_path = $path; |
|
21
|
1
|
|
|
|
|
3
|
last; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
139
|
my $abs_path = $path->absolute; |
|
25
|
1
|
50
|
|
|
|
37
|
if ($paths{$abs_path}) { |
|
26
|
0
|
|
|
|
|
0
|
croak '! cpanfile is not found. Please put cpanfile on a project root.'; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
5
|
$paths{$abs_path}++; |
|
30
|
1
|
|
|
|
|
5
|
$path = $path->parent; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
4
|
return $project_root_path; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub document_path { |
|
37
|
14
|
|
|
14
|
0
|
107
|
my ($class, $output_path) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
14
|
|
|
|
|
87
|
(my $document_name = $FindBin::Script) =~ s/\.t$//; |
|
40
|
14
|
|
|
|
|
35
|
my $markdown_file = "$document_name.md"; |
|
41
|
|
|
|
|
|
|
|
|
42
|
14
|
|
|
|
|
19
|
my $document_path; |
|
43
|
14
|
50
|
|
|
|
268
|
if ($output_path) { |
|
44
|
14
|
50
|
|
|
|
83
|
if ($output_path =~ m!^~?/!) { |
|
45
|
|
|
|
|
|
|
# Absolute path |
|
46
|
14
|
|
|
|
|
157
|
$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
|
14
|
|
|
|
|
1231
|
$document_path->touchpath; |
|
60
|
|
|
|
|
|
|
|
|
61
|
14
|
|
|
|
|
237633
|
return $document_path; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |