line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::JsonAPI::Autodoc::Path; |
2
|
16
|
|
|
16
|
|
16056
|
use strict; |
|
16
|
|
|
|
|
22
|
|
|
16
|
|
|
|
|
481
|
|
3
|
16
|
|
|
16
|
|
64
|
use warnings; |
|
16
|
|
|
|
|
20
|
|
|
16
|
|
|
|
|
308
|
|
4
|
16
|
|
|
16
|
|
59
|
use utf8; |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
96
|
|
5
|
16
|
|
|
16
|
|
289
|
use Carp; |
|
16
|
|
|
|
|
24
|
|
|
16
|
|
|
|
|
879
|
|
6
|
16
|
|
|
16
|
|
7140
|
use FindBin; |
|
16
|
|
|
|
|
12489
|
|
|
16
|
|
|
|
|
614
|
|
7
|
16
|
|
|
16
|
|
1453
|
use Path::Tiny; |
|
16
|
|
|
|
|
22430
|
|
|
16
|
|
|
|
|
754
|
|
8
|
|
|
|
|
|
|
|
9
|
16
|
|
|
16
|
|
73
|
use constant end_condition_file => 'cpanfile'; |
|
16
|
|
|
|
|
23
|
|
|
16
|
|
|
|
|
5242
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub find_project_root_path { |
12
|
1
|
|
|
1
|
0
|
13
|
my $class = shift; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
5
|
my $path = path($FindBin::Bin); |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
38
|
my %paths; |
17
|
|
|
|
|
|
|
my $project_root_path; |
18
|
1
|
|
|
|
|
2
|
while (1) { |
19
|
2
|
100
|
|
|
|
50
|
if (-f $path->child(end_condition_file)) { |
20
|
1
|
|
|
|
|
37
|
$project_root_path = $path; |
21
|
1
|
|
|
|
|
2
|
last; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
100
|
my $abs_path = $path->absolute; |
25
|
1
|
50
|
|
|
|
61
|
if ($paths{$abs_path}) { |
26
|
0
|
|
|
|
|
0
|
croak '! cpanfile is not found. Please put cpanfile on a project root.'; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
9
|
$paths{$abs_path}++; |
30
|
1
|
|
|
|
|
9
|
$path = $path->parent; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
5
|
return $project_root_path; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub document_path { |
37
|
16
|
|
|
16
|
0
|
28
|
my ($class, $output_path) = @_; |
38
|
|
|
|
|
|
|
|
39
|
16
|
|
|
|
|
99
|
(my $document_name = $FindBin::Script) =~ s/\.t$//; |
40
|
16
|
|
|
|
|
42
|
my $markdown_file = "$document_name.md"; |
41
|
|
|
|
|
|
|
|
42
|
16
|
|
|
|
|
20
|
my $document_path; |
43
|
16
|
50
|
|
|
|
287
|
if ($output_path) { |
44
|
16
|
50
|
|
|
|
101
|
if ($output_path =~ m!^~?/!) { |
45
|
|
|
|
|
|
|
# Absolute path |
46
|
16
|
|
|
|
|
180
|
$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
|
16
|
|
|
|
|
1182
|
$document_path->touchpath; |
60
|
|
|
|
|
|
|
|
61
|
16
|
|
|
|
|
4946
|
return $document_path; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |