| 1 | package Dist::Zilla::Plugin::Authors; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Git::Wrapper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use List::MoreUtils qw(uniq); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | with qw/Dist::Zilla::Role::FileGatherer/; | |
| 9 | |||
| 10 | 0 | ▶ | sub git_log_grep { |
|
Subroutine
git_log_grep: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 11 | 0 | my $string = shift; | |
| 12 | 0 | my $git = shift; | |
| 13 | 0 | return map { s/^\s*$string\s*//; $_ } | |
| 14 | 0 | grep { /$string/ } | |
| 15 | $git->RUN('log', {grep => $string}); | ||
| 16 | } | ||
| 17 | |||
| 18 | 0 | ▶ | sub gather_files { |
|
Subroutine
gather_files: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 19 | 0 | my ($self, $arg) = @_; | |
| 20 | my $file = Dist::Zilla::File::FromCode->new({ | ||
| 21 | name => 'AUTHORS', | ||
| 22 | code_return_type => 'bytes', | ||
| 23 | 0 | ▶ | code => sub { |
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||
| 24 | 0 | my $git = Git::Wrapper->new('./'); | |
| 25 | 0 | my @authors = $git->RUN('log', {pretty => "format:%aN <%aE>"}); | |
| 26 | 0 | my @signed_authors = git_log_grep('Signed-off-by:', $git); | |
| 27 | 0 | my @co_authors = git_log_grep('Co-authored-by:', $git); | |
| 28 | 0 | foreach (@signed_authors, @co_authors) { | |
| 29 | 0 | eval { | |
| 30 | 0 | my @_co_authors = $git->RUN('check-mailmap', $_); | |
| 31 | 0 | push @authors, @_co_authors; | |
| 32 | }; | ||
| 33 | } | ||
| 34 | 0 | return join("\n", uniq sort @authors); | |
| 35 | }, | ||
| 36 | 0 | }); | |
| 37 | 0 | $self->add_file($file); | |
| 38 | 0 | return; | |
| 39 | } | ||
| 40 | |||
| 41 | 1 | 1; | |
| 42 | |||
| 43 | __END__ | ||