| 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
MC/DC0%0/2
$cmd ||= $self->help
$cmd
$self->help
Truth table0%0/3
A ||= B
A= $cmdB= $self->help
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( not defined $self->{'repo'} and $cmd ne 'init' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"repo"} and $cmd ne "init"
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"
| |||||||||||||||||||||||||||||
| 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'} || '.'
MC/DC0%0/1
$self->{'dir'} || '.'
$self->{'dir'}
Truth table0%0/2
A
A= $self->{'dir'}
| |||||||||||||||||||||||||||||
| 48 | 0 | $self->{'repo'} = Git::Repository->new( work_tree => $dir ); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 6 | 1; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||