| 1 | package Git::CPAN::Patch::Role::Git; | ||||||||||||||
| 2 | 3 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||||||
| 3 | #ABSTRACT: provides access to Git repository | ||||||||||||||
| 4 | 3 | $Git::CPAN::Patch::Role::Git::VERSION = '2.3.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 Method::Signatures::Simple; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 11 | ▶ | use version; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | |||||||||||||||
| 11 | 11 | ▶ | use Moose::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 11 | ▶ | use MooseX::App::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | 11 | ▶ | use MooseX::SemiAffordanceAccessor; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | |||||||||||||||
| 15 | 11 | ▶ | use Git::Repository; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 3 | option root => ( | |||||||||||||
| 18 | is => 'rw', | ||||||||||||||
| 19 | isa => 'Str', | ||||||||||||||
| 20 | default => '.' , | ||||||||||||||
| 21 | documentation => 'Location of the Git repository', | ||||||||||||||
| 22 | ); | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 1 | ▶ | has git => ( | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 25 | 1 | is => 'ro', | |||||||||||||
| 26 | isa => 'Git::Repository', | ||||||||||||||
| 27 | lazy => 1, | ||||||||||||||
| 28 | default => method { | ||||||||||||||
| 29 | 3 | Git::Repository->new( | |||||||||||||
| 30 | work_tree => $self->root | ||||||||||||||
| 31 | ); | ||||||||||||||
| 32 | }, | ||||||||||||||
| 33 | handles => { | ||||||||||||||
| 34 | 11 | ▶ | git_run => 'run', | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.6
Subroutine
last_commit: not called CC=1 SCAR=0.8
Subroutine
__ANON__: called CC=1 SCAR=0.8
| |||||||||||||||
| 35 | 0 | }, | |||||||||||||
| 36 | 3 | ); | |||||||||||||
| 37 | |||||||||||||||
| 38 | 11 | ▶ | method last_commit { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.6
Subroutine
last_imported_version: not called CC=3 SCAR=19.4
Subroutine
__ANON__: called CC=3 SCAR=19.4
| |||||||||||||||
| 39 | 0 | ▶ | eval { $self->git_run('rev-parse', '--verify', 'cpan/master') } | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 40 | } | ||||||||||||||
| 41 | 0 | ||||||||||||||
| 42 | method last_imported_version { | ||||||||||||||
| 43 | 0 | ▶ | my $last_commit = $self->last_commit or return version->parse(0); | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 44 | |||||||||||||||
| 45 | my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit ); | ||||||||||||||
| 46 | 0 | ||||||||||||||
| 47 | 3 | $last =~ /git-cpan-module:\ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx | |||||||||||||
| 48 | or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n"; | ||||||||||||||
| 49 | 11 | ▶ | |||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.1
Subroutine
__ANON__: not called CC=3 SCAR=23.8
Subroutine
tracked_distribution: not called CC=3 SCAR=23.8
| |||||||||||||||
| 50 | 0 | ▶ | return version->parse($2); | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 51 | } | ||||||||||||||
| 52 | 0 | ||||||||||||||
| 53 | method tracked_distribution { | ||||||||||||||
| 54 | 0 | ▶ | my $last_commit = $self->last_commit or return; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 55 | |||||||||||||||
| 56 | my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit ); | ||||||||||||||
| 57 | 0 | ||||||||||||||
| 58 | 3 | $last =~ /git-cpan-module:\s+ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx | |||||||||||||
| 59 | or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n"; | ||||||||||||||
| 60 | 11 | ▶ | |||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.6
Subroutine
first_import: not called CC=1 SCAR=0.8
Subroutine
__ANON__: called CC=1 SCAR=0.8
| |||||||||||||||
| 61 | 0 | return $1; | |||||||||||||
| 62 | 3 | } | |||||||||||||
| 63 | |||||||||||||||
| 64 | 3 | method first_import { | |||||||||||||
| 65 | return !$self->last_commit; | ||||||||||||||
| 66 | } | ||||||||||||||
| 67 | |||||||||||||||
| 68 | 1; | ||||||||||||||
| 69 | |||||||||||||||
| 70 | __END__ | ||||||||||||||
| 71 | |||||||||||||||
| 72 | =pod | ||||||||||||||
| 73 | |||||||||||||||
| 74 | =encoding UTF-8 | ||||||||||||||
| 75 | |||||||||||||||
| 76 | =head1 NAME | ||||||||||||||
| 77 | |||||||||||||||
| 78 | Git::CPAN::Patch::Role::Git - provides access to Git repository | ||||||||||||||
| 79 | |||||||||||||||
| 80 | =head1 VERSION | ||||||||||||||
| 81 | |||||||||||||||
| 82 | version 2.3.2 | ||||||||||||||
| 83 | |||||||||||||||
| 84 | =head1 AUTHOR | ||||||||||||||
| 85 | |||||||||||||||
| 86 | Yanick Champoux <yanick@cpan.org> | ||||||||||||||
| 87 | |||||||||||||||
| 88 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||
| 89 | |||||||||||||||
| 90 | This software is copyright (c) 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009 by Yanick Champoux. | ||||||||||||||
| 91 | |||||||||||||||
| 92 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||
| 93 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||
| 94 | |||||||||||||||
| 95 | =cut | ||||||||||||||