line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
78307
|
use strict; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
121
|
|
2
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
21
|
|
|
4
|
|
|
|
|
227
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::ResourceManager; |
5
|
|
|
|
|
|
|
$Footprintless::ResourceManager::VERSION = '1.26'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A manager for finding and retrieving resources |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::ResourceManager |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
22
|
use parent qw(Footprintless::MixableBase); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
37
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
271
|
use Carp; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
324
|
|
12
|
4
|
|
|
|
|
209
|
use Footprintless::Mixins qw( |
13
|
|
|
|
|
|
|
_entity |
14
|
4
|
|
|
4
|
|
311
|
); |
|
4
|
|
|
|
|
13
|
|
15
|
4
|
|
|
4
|
|
1398
|
use Footprintless::Resource::Maven; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
109
|
|
16
|
4
|
|
|
4
|
|
1016
|
use Footprintless::Resource::Url; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
111
|
|
17
|
4
|
|
|
|
|
1264
|
use Footprintless::Util qw( |
18
|
|
|
|
|
|
|
dynamic_module_new |
19
|
4
|
|
|
4
|
|
27
|
); |
|
4
|
|
|
|
|
11
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub download { |
22
|
19
|
|
|
19
|
1
|
78
|
my ( $self, $resource, @options ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
19
|
|
|
|
|
45
|
foreach my $provider ( @{ $self->{providers} } ) { |
|
19
|
|
|
|
|
73
|
|
25
|
19
|
50
|
|
|
|
87
|
if ( $provider->supports($resource) ) { |
26
|
19
|
|
|
|
|
144
|
return $provider->download( $resource, @options ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
croak("unsupported resource type [$resource]"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _init { |
34
|
13
|
|
|
13
|
|
39
|
my ( $self, @options ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
13
|
|
|
|
|
46
|
$self->{providers} = (); |
37
|
13
|
|
|
|
|
344
|
my $providers = $self->_entity('footprintless.resource_manager.providers'); |
38
|
13
|
100
|
|
|
|
45
|
if ($providers) { |
39
|
3
|
|
|
|
|
8
|
foreach my $provider_module (@$providers) { |
40
|
|
|
|
|
|
|
push( |
41
|
3
|
|
|
|
|
14
|
@{ $self->{providers} }, |
42
|
|
|
|
|
|
|
dynamic_module_new( |
43
|
|
|
|
|
|
|
$provider_module, $self->{factory}, $self->{coordinate}, @options |
44
|
3
|
|
|
|
|
5
|
) |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
10
|
|
|
|
|
27
|
eval { |
50
|
|
|
|
|
|
|
# Maven::Agent may not be available... |
51
|
|
|
|
|
|
|
push( |
52
|
10
|
|
|
|
|
80
|
@{ $self->{providers} }, |
53
|
|
|
|
|
|
|
dynamic_module_new( |
54
|
|
|
|
|
|
|
'Footprintless::Resource::MavenProvider', |
55
|
|
|
|
|
|
|
$self->{factory}, $self->{coordinate}, @options |
56
|
10
|
|
|
|
|
143
|
) |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
push( |
61
|
10
|
|
|
|
|
63
|
@{ $self->{providers} }, |
62
|
|
|
|
|
|
|
dynamic_module_new( |
63
|
|
|
|
|
|
|
'Footprintless::Resource::UrlProvider', $self->{factory}, |
64
|
|
|
|
|
|
|
$self->{coordinate}, @options |
65
|
10
|
|
|
|
|
52657
|
) |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
11
|
|
|
|
|
54
|
return $self; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub resource { |
73
|
3
|
|
|
3
|
1
|
270
|
my ( $self, $spec ) = @_; |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
|
|
6
|
foreach my $provider ( @{ $self->{providers} } ) { |
|
3
|
|
|
|
|
8
|
|
76
|
3
|
50
|
|
|
|
11
|
if ( $provider->supports($spec) ) { |
77
|
3
|
|
|
|
|
11
|
return $provider->resource($spec); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
croak("unsupported resource: $spec"); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |