Flux.pm

filter: Statementstmt 60.6% 20 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 66.6% 6 / 9 Podpod 100% 3 / 3 totaltotal 48.3% 29 / 60 CC 5 SCAR 20.4
CC
5
Cov
47%
run
20.0
create_repo
6.0
new
2.0
CRAP 7.7
« Flux/Utils.pm ↑ Summary Flux/Command/help.pm »
1 package Git::Flux;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 ▶use Git::Repository;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # common
9 6 ▶use mixin 'Git::Flux::Utils';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # commands
12 6 ▶use mixin 'Git::Flux::Command::init';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use mixin 'Git::Flux::Command::help';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 our $VERSION = '0.0_03';
16  
17 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
18 0 my $class = shift;
19 0 my %opts = @_;
20 my $self = {
21 dir => $opts{'dir'},
22 0 repo => $opts{'repo'},
23 };
24  
25 # TODO: add variables here for prefix (origin, feature, etc.)
26  
27 0 bless $self, $class;
28 }
29  
30 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod documented
31 0 my $self = shift;
32 0 my ( $cmd, @opts ) = @_;
33  
34 # run help if no other cmd
35 0 ▶ $cmd ||= $self->help();
Condition0%0/3
$cmd ||= $self->help
l!l&&r!l&&!r
000
MC/DC0%0/2
$cmd ||= $self->help
$cmd $self->help
Truth table0%0/3
A ||= B
A= $cmdB= $self->help
ABresult
1X1
011
000
36  
37 0 ▶ if ( not defined $self->{'repo'} and $cmd ne 'init' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $self->{"repo"} and $cmd ne "init") 0 0 0
Condition0%0/3
not defined $self->{"repo"} and $cmd ne "init"
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $self->{"repo"} and $cmd ne "init"
not defined $self->{"repo"} $cmd ne "init"
Truth table0%0/3
not(A) and B
A= not defined $self->{"repo"}B= $cmd ne "init"
ABresult
0X0
100
111
38 # create the repo now
39 0 $self->create_repo();
40 }
41  
42 0 $self->$cmd(@opts);
43 }
44  
45 0 ▶sub create_repo {
Subroutine create_repo: not called CC=2 SCAR=17.9
Pod documented
46 0 my $self = shift;
47 0 ▶ my $dir = $self->{'dir'} || '.';
Condition0%0/2
$self->{'dir'} || '.'
l!l
00
MC/DC0%0/1
$self->{'dir'} || '.'
$self->{'dir'}
Truth table0%0/2
A
A= $self->{'dir'}
Aresult
11
00
48 0 $self->{'repo'} = Git::Repository->new( work_tree => $dir );
49 }
50  
51 6 1;
52  
53 __END__
« Flux/Utils.pm ↑ Summary Flux/Command/help.pm »