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.3.4';
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/
17 signatures
18 postderef
19 11 ▶/;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 => (
Subroutine __ANON__: called CC=1 SCAR=0.0
29 is => 'ro',
30 isa => 'Git::Repository',
31 lazy => 1,
32 default => sub ($self) {
33 1 Git::Repository->new(
34 work_tree => $self->root
35 );
36 },
37 11 handles => {
38 git_run => 'run',
39 },
40 );
41  
42 ▶sub last_commit ($self) {
Subroutine last_commit: called CC=1 SCAR=0.0
Pod undocumented
43 3 eval { $self->git_run('rev-parse', '--verify', 'cpan/master') }
44 }
45  
46 ▶sub last_imported_version ($self) {
Subroutine last_imported_version: called CC=3 SCAR=19.2
Pod undocumented
47 1 ▶ 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) 1 0 1
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 ▶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 1 ▶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__
73  
74 =pod
75  
76 =encoding UTF-8
77  
78 =head1 NAME
79  
80 Git::CPAN::Patch::Role::Git - provides access to Git repository
81  
82 =head1 VERSION
83  
84 version 2.3.4
85  
86 =head1 AUTHOR
87  
88 Yanick Champoux <yanick@cpan.org>
89  
90 =head1 COPYRIGHT AND LICENSE
91  
92 This software is copyright (c) 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009 by Yanick Champoux.
93  
94 This is free software; you can redistribute it and/or modify it under
95 the same terms as the Perl 5 programming language system itself.
96  
97 =cut
« Patch/Command/Clone.pm ↑ Summary Patch/Command/Update.pm »