blib/lib/Shipwright/Source/Shipyard.pm

filter: Statementstmt 38.1% 16 / 42 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 31.8% 22 / 69 CC 11 SCAR 45.1
CC
11
Cov
27%
run
132.0
BEGIN
1.0
BEGIN
1.0
CRAP 91.1
« blib/lib/Shipwright/Script/Flags.pm ↑ Summary blib/lib/Shipwright/Source/CPAN.pm »
1 package Shipwright::Source::Shipyard;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Shipwright::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Spec::Functions qw/catdir/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw/Shipwright::Source::Base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head2 run
11  
12 =cut
13  
14 0 ▶sub run {
Subroutine run: not called CC=11 SCAR=48.8
Pod documented
15 0 my $self = shift;
16  
17 0 $self->log->info( "preparing to run source: " . $self->source );
18 0 my ( $base, $dist ) = $self->source =~ m{(.*)/([^/]+)};
19  
20 0 my $source_shipwright = Shipwright->new( repository => $base );
21 0 ▶ $self->name($dist) unless $self->name;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->name 0 0 0
22  
23 0 ▶ if ( $source_shipwright->backend->has_branch_support ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($source_shipwright->backend->has_branch_support) { } 0 0 0
24 0 $source_shipwright->backend->export(
25 target => catdir( $self->directory, $self->name ),
26 path => "/sources/$dist",
27 );
28 }
29 else {
30 0 $source_shipwright->backend->export(
31 target => catdir( $self->directory, $self->name ),
32 path => "/dists/$dist",
33 );
34 }
35  
36 0 $source_shipwright->backend->export(
37 target => catdir( $self->scripts_directory, $self->name ),
38 path => "/scripts/$dist",
39 );
40 0 my $source_version = $source_shipwright->backend->version->{$dist};
41 0 my $source_branch;
42 0 ▶ if ( $source_shipwright->backend->branches
Branch: 1 branch
BranchTrueFalseTotal
if ($source_shipwright->backend->branches and $source_shipwright->backend->branches->{$dist}) 0 0 0
Condition0%0/3
$source_shipwright->backend->branches and $source_shipwright->backend->branches->{$dist}
!ll&&!rl&&r
000
MC/DC0%0/2
$source_shipwright->backend->branches and $source_shipwright->backend->branches->{$dist}
$source_shipwright->backend->branches $source_shipwright->backend->branches->{$dist}
Truth table0%0/3
A and B
A= $source_shipwright->backend->branchesB= $source_shipwright->backend->branches->{$dist}
ABresult
0X0
100
111
43 && $source_shipwright->backend->branches->{$dist} )
44 {
45 0 $source_branch = $source_shipwright->backend->branches->{$dist};
46 }
47  
48 0 $self->_update_version( $self->name, $source_version );
49 0 $self->_update_url( $self->name, 'shipyard:' . $self->source );
50 0 ▶ $self->_update_branches( $self->name, $source_branch ) if $source_branch;
Branch: 1 branch
BranchTrueFalseTotal
if $source_branch 0 0 0
51  
52 # follow
53 0 ▶ if ( $self->follow ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->follow) 0 0 0
54 0 my $out = run_cmd(
55 $source_shipwright->backend->_cmd(
56 'cat', path => "/scripts/$dist/require.yml",
57 ),
58 1
59 );
60 0 ▶ my $require = load_yaml($out) || {};
Condition0%0/2
load_yaml($out) || {}
l!l
00
MC/DC0%0/1
load_yaml($out) || {}
load_yaml($out)
Truth table0%0/2
A
A= load_yaml($out)
Aresult
11
00
61  
62 0 for my $type ( keys %$require ) {
63 0 for my $req ( keys %{ $require->{$type} } ) {
64 0 ▶ unless ( -e catdir( $self->directory, $req ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e catdir($self->directory, $req)) 0 0 0
65 0 my $s = Shipwright::Source->new(
66 %$self,
67 source => "shipyard:$base/$req",
68 name => $req
69 );
70 0 $s->run;
71 }
72 }
73 }
74 }
75  
76 0 return catdir( $self->directory, $self->name );
77 }
78  
79 1 1;
80  
81 __END__
« blib/lib/Shipwright/Script/Flags.pm ↑ Summary blib/lib/Shipwright/Source/CPAN.pm »