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