CLI/Git.pm

filter: Statementstmt 65.3% 34 / 52 Branchbran 30.0% 3 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 4 / 4 totaltotal 63.0% 46 / 73 CC 7 SCAR 12.9
CC
7
Cov
60%
checkout
6.0
pull
6.0
clone
4.1
CRAP 3.6
« CLI/Registry.pm ↑ Summary CLI/Package.pm »
1 # PODNAME: Luv::CLI::Git
2 # ABSTRACT: git operations for fetching and updating library dependencies
3  
4 2 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use IPC::Run qw(run);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 class Luv::CLI::Git;
10  
11 1 ▶method clone ( $url, $dest, $ref = undef ) {
Subroutine clone: called CC=4 SCAR=14.1
Pod documented
12 1 my @cmd = ( 'git', 'clone', $url, $dest );
13 1 my ( $out, $err );
14 1 ▶ IPC::Run::run( \@cmd, \undef, \$out, \$err )
Branch: 1 branch
BranchTrueFalseTotal
IPC::Run::run(\@cmd, \(undef), \$out, \$err) or die "git clone failed for '${url}':\n$err" 1 0 1
15 or die "git clone failed for '$url':\n$err";
16  
17 1 ▶ if ( defined $ref ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref) 0 1 1
18 0 $self->checkout( $dest, $ref );
19 }
20  
21 1 return 1;
22 2 }
23  
24 0 ▶method checkout ( $dest, $ref ) {
Subroutine checkout: not called CC=2 SCAR=17.9
Pod documented
25 0 my @cmd = ( 'git', '-C', $dest, 'checkout', $ref );
26 0 my ( $out, $err );
27 0 ▶ IPC::Run::run( \@cmd, \undef, \$out, \$err )
Branch: 1 branch
BranchTrueFalseTotal
IPC::Run::run(\@cmd, \(undef), \$out, \$err) or die "git checkout '${ref}' failed in '${dest}':\n$err" 0 0 0
28 or die "git checkout '$ref' failed in '$dest':\n$err";
29  
30 0 return 1;
31 2 }
32  
33 0 ▶method pull ($dest) {
Subroutine pull: not called CC=2 SCAR=17.9
Pod documented
34 0 my @cmd = ( 'git', '-C', $dest, 'pull' );
35 0 my ( $out, $err );
36 0 ▶ IPC::Run::run( \@cmd, \undef, \$out, \$err )
Branch: 1 branch
BranchTrueFalseTotal
IPC::Run::run(\@cmd, \(undef), \$out, \$err) or die "git pull failed in '${dest}':\n$err" 0 0 0
37 or die "git pull failed in '$dest':\n$err";
38  
39 0 return 1;
40 2 }
41  
42 1 ▶method current_ref ($dest) {
Subroutine current_ref: called CC=2 SCAR=6.9
Pod documented
43 1 my @cmd = ( 'git', '-C', $dest, 'rev-parse', 'HEAD' );
44 1 my ( $out, $err );
45 1 ▶ IPC::Run::run( \@cmd, \undef, \$out, \$err )
Branch: 1 branch
BranchTrueFalseTotal
IPC::Run::run(\@cmd, \(undef), \$out, \$err) or die "git rev-parse failed in '${dest}':\n$err" 1 0 1
46 or die "git rev-parse failed in '$dest':\n$err";
47  
48 1 chomp $out;
49 1 return $out;
50 2 }
51  
52 2 1;
53  
54 __END__
« CLI/Registry.pm ↑ Summary CLI/Package.pm »