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