Patch/Role/Git.pm

filter: Statementstmt 82.9% 34 / 41 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 4 totaltotal 71.2% 47 / 66 CC 5 SCAR 13.8
CC
5
Cov
71%
tracked_distribution
12.0
last_imported_version
6.8
BEGIN
1.0
CRAP 4.0
« Patch/Command/Clone.pm ↑ Summary Patch/Command/Update.pm »
1 package Git::CPAN::Patch::Role::Git;
2 11 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: provides access to Git repository
4 11 $Git::CPAN::Patch::Role::Git::VERSION = '2.5.2';
5 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 11 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use MooseX::App::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 11 ▶use Git::Repository;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 11 ▶use experimental qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
17 signatures
18 postderef
19 11 /;
20  
21 11 option root => (
22 is => 'rw',
23 isa => 'Str',
24 default => '.' ,
25 documentation => 'Location of the Git repository',
26 );
27  
28 has git => (
29 is => 'ro',
30 isa => 'Git::Repository',
31 lazy => 1,
32 2 ▶ default => sub ($self) {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 2 Git::Repository->new(
34 work_tree => $self->root
35 );
36 },
37 11 handles => {
38 git_run => 'run',
39 },
40 );
41  
42 6 ▶sub last_commit ($self) {
Subroutine last_commit: called CC=1 SCAR=0.0
Pod undocumented
43 6 eval { $self->git_run('rev-parse', '--verify', 'cpan/master') }
44 }
45  
46 2 ▶sub last_imported_version ($self) {
Subroutine last_imported_version: called CC=3 SCAR=19.2
Pod undocumented
47 2 ▶ my $last_commit = $self->last_commit or return version->parse(0);
Branch: 1 branch
BranchTrueFalseTotal
my $last_commit = $self->last_commit or return "version"->parse(0) 0 2 2
48  
49 0 my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit );
50  
51 0 ▶ $last =~ /git-cpan-module:\ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx
Branch: 1 branch
BranchTrueFalseTotal
$last =~ /git-cpan-module:\ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n" 0 0 0
52 or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n";
53  
54 0 return version->parse($2);
55 }
56  
57 0 ▶sub tracked_distribution ($self) {
Subroutine tracked_distribution: not called CC=3 SCAR=24.8
Pod undocumented
58 0 ▶ my $last_commit = $self->last_commit or return;
Branch: 1 branch
BranchTrueFalseTotal
my $last_commit = $self->last_commit or return 0 0 0
59  
60 0 my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit );
61  
62 0 ▶ $last =~ /git-cpan-module:\s+ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx
Branch: 1 branch
BranchTrueFalseTotal
$last =~ /git-cpan-module:\s+ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n" 0 0 0
63 or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n";
64  
65 0 return $1;
66 }
67  
68 2 ▶sub first_import { return !$_[0]->last_commit }
Subroutine first_import: called CC=1 SCAR=0.0
Pod undocumented
69  
70 11 1;
71  
72 __END__
« Patch/Command/Clone.pm ↑ Summary Patch/Command/Update.pm »