Footprintless/Resource/MavenProvider.pm

filter: Statementstmt 100% 29 / 29 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 92.1% 47 / 51 CC 7 SCAR 10.7
CC
7
Cov
90%
supports
5.1
resource
3.2
BEGIN
1.0
CRAP 2.9
« Footprintless/App/Command/log/tail.pm ↑ Summary Footprintless/App/UsageException.pm »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Footprintless::Resource::MavenProvider;
5 4 $Footprintless::Resource::MavenProvider::VERSION = '1.29';
6 # ABSTRACT: A resource provider for resources retrieved by maven coordinate
7 # PODNAME: Footprintless::Resource::MavenProvider
8  
9 4 ▶use parent qw(Footprintless::Resource::Provider);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use Maven::Agent;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub _download {
Subroutine _download: called CC=1 SCAR=0.0
14 1 my ( $self, $resource, %options ) = @_;
15 1 return $self->{maven_agent}->download( $resource->get_artifact(), %options );
16 }
17  
18 10 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
19 10 my ( $self, %options ) = @_;
20  
21 10 $self->{maven_agent} = Maven::Agent->new( agent => $self->{factory}->agent() );
22  
23 10 return $self;
24 }
25  
26 3 ▶sub resource {
Subroutine resource: called CC=3 SCAR=11.7
Pod documented
27 3 my ( $self, $spec ) = @_;
28  
29 3 ▶ return $spec if ( UNIVERSAL::isa( $spec, 'Footprintless::Resource::Maven' ) );
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($spec, "Footprintless::Resource::Maven") 0 3 3
30  
31 return Footprintless::Resource::Maven->new(
32 3 ▶ $self->{maven_agent}->resolve_or_die( ref($spec) ? $spec->{coordinate} : $spec ) );
Branch: 1 branch
BranchTrueFalseTotal
ref $spec ? : 0 3 3
33 }
34  
35 24 ▶sub supports {
Subroutine supports: called CC=5 SCAR=16.2
Pod documented
36 24 my ( $self, $resource ) = @_;
37  
38 24 ▶ return 1 if ( UNIVERSAL::isa( $resource, 'Footprintless::Resource::Maven' ) );
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($resource, "Footprintless::Resource::Maven") 0 24 24
39  
40 24 my $ref = ref($resource);
41 24 ▶ if ($ref) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ref) { } 7 17 24
elsif ($resource =~ /^(?:[^:]+:){2,4}[^:]+$/) { } 3 14 17
42 7 ▶ return 1 if ( $resource->{coordinate} );
Branch: 1 branch
BranchTrueFalseTotal
if $resource->{"coordinate"} 0 7 7
43 }
44 elsif ( $resource =~ /^(?:[^:]+:){2,4}[^:]+$/ ) {
45 3 return 1;
46 }
47  
48 21 return 0;
49 }
50  
51 4 1;
52  
53 __END__
« Footprintless/App/Command/log/tail.pm ↑ Summary Footprintless/App/UsageException.pm »