| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Fetch::LocalDir; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1244
|
use strict; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
88
|
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
68
|
|
|
5
|
3
|
|
|
3
|
|
56
|
use 5.008004; |
|
|
3
|
|
|
|
|
15
|
|
|
6
|
3
|
|
|
3
|
|
345
|
use Alien::Build::Plugin; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
33
|
|
|
7
|
3
|
|
|
3
|
|
453
|
use File::chdir; |
|
|
3
|
|
|
|
|
2779
|
|
|
|
3
|
|
|
|
|
399
|
|
|
8
|
3
|
|
|
3
|
|
22
|
use Path::Tiny (); |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
1439
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Plugin for fetching a local directory |
|
11
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has root => undef; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has ssl => 0; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
2
|
|
|
2
|
1
|
5
|
my($self, $meta) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
50
|
|
|
13
|
my $url = $meta->prop->{start_url} || 'patch'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
16
|
$meta->add_requires('configure' => 'Alien::Build::Plugin::Fetch::LocalDir' => '0.72' ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
11
|
if($url =~ /^file:/) |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
0
|
|
|
|
|
0
|
$meta->add_requires('share' => 'URI' => 0 ); |
|
30
|
0
|
|
|
|
|
0
|
$meta->add_requires('share' => 'URI::file' => 0 ); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
{ |
|
34
|
2
|
|
|
|
|
4
|
my $root = $self->root; |
|
|
2
|
|
|
|
|
6
|
|
|
35
|
2
|
50
|
|
|
|
6
|
if(defined $root) |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
0
|
|
|
|
|
0
|
$root = Path::Tiny->new($root)->absolute->stringify; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
else |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
2
|
|
|
|
|
14
|
$root = "$CWD"; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
2
|
|
|
|
|
55
|
$self->root($root); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$meta->register_hook( |
|
47
|
|
|
|
|
|
|
fetch => sub { |
|
48
|
2
|
|
|
2
|
|
6
|
my($build, $path, %options) = @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
2
|
50
|
|
|
|
21
|
$build->log("plugin Fetch::LocalDir does not support http_headers option") if $options{http_headers}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
2
|
|
33
|
|
|
11
|
$path ||= $url; |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
50
|
|
|
|
7
|
if($path =~ /^file:/) |
|
55
|
|
|
|
|
|
|
{ |
|
56
|
0
|
|
|
|
|
0
|
my $root = URI::file->new($self->root); |
|
57
|
0
|
|
|
|
|
0
|
my $url = URI->new_abs($path, $root); |
|
58
|
0
|
|
|
|
|
0
|
$path = $url->path; |
|
59
|
0
|
0
|
|
|
|
0
|
$path =~ s{^/([a-z]:)}{$1}i if $^O eq 'MSWin32'; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
16
|
$path = Path::Tiny->new($path)->absolute($self->root); |
|
63
|
|
|
|
|
|
|
|
|
64
|
2
|
50
|
|
|
|
223
|
if(-d $path) |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
|
|
|
|
|
|
return { |
|
67
|
2
|
|
|
|
|
207
|
type => 'file', |
|
68
|
|
|
|
|
|
|
filename => $path->basename, |
|
69
|
|
|
|
|
|
|
path => $path->stringify, |
|
70
|
|
|
|
|
|
|
tmp => 0, |
|
71
|
|
|
|
|
|
|
}; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
else |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
0
|
|
|
|
|
|
$build->log("path $path is not a directory"); |
|
76
|
0
|
|
|
|
|
|
$build->log("(you specified $url with root @{[ $self->root ]})"); |
|
|
0
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
die "$path is not a directory"; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
2
|
|
|
|
|
18
|
); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |