| 1 | 19 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 19 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package Dist::Zilla::Plugin::Git::Contributors; # git description: v0.038-2-g4b309b0 | ||||||||||||||||||||||||||||
| 4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||||||||||||||||||||||||||
| 5 | # ABSTRACT: Add contributor names from git to your distribution | ||||||||||||||||||||||||||||
| 6 | # KEYWORDS: plugin distribution metadata git contributors authors commits | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 19 | our $VERSION = '0.039'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 19 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 19 | with 'Dist::Zilla::Role::MetaProvider', | |||||||||||||||||||||||||||
| 12 | 'Dist::Zilla::Role::PrereqSource'; | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 19 | ▶ | use List::Util 1.33 qw(none any); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 19 | ▶ | use Git::Wrapper 0.035; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 19 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 19 | ▶ | use Path::Tiny 0.048; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 19 | ▶ | use Moose::Util::TypeConstraints 'enum'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 19 | ▶ | use List::UtilsBy 0.04 'uniq_by'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 19 | ▶ | use Unicode::Collate 0.53; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 19 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 19 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 20 | ▶ | sub mvp_multivalue_args { qw(paths remove) } | ||||||||||||||||||||||||||
|
Subroutine
mvp_multivalue_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 20 | ▶ | sub mvp_aliases { return { path => 'paths' } } | ||||||||||||||||||||||||||
|
Subroutine
mvp_aliases: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 19 | has include_authors => ( | |||||||||||||||||||||||||||
| 28 | is => 'ro', isa => 'Bool', | ||||||||||||||||||||||||||||
| 29 | default => 0, | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 19 | has include_releaser => ( | |||||||||||||||||||||||||||
| 33 | is => 'ro', isa => 'Bool', | ||||||||||||||||||||||||||||
| 34 | default => 1, | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 19 | has order_by => ( | |||||||||||||||||||||||||||
| 38 | is => 'ro', isa => enum([qw(name commits)]), | ||||||||||||||||||||||||||||
| 39 | default => 'name', | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | has paths => ( | ||||||||||||||||||||||||||||
| 43 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 44 | lazy => 1, | ||||||||||||||||||||||||||||
| 45 | 17 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 19 | traits => ['Array'], | |||||||||||||||||||||||||||
| 47 | handles => { paths => 'elements' }, | ||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | has remove => ( | ||||||||||||||||||||||||||||
| 51 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 52 | lazy => 1, | ||||||||||||||||||||||||||||
| 53 | 18 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | 19 | traits => ['Array'], | |||||||||||||||||||||||||||
| 55 | handles => { remove => 'elements' }, | ||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | around dump_config => sub | ||||||||||||||||||||||||||||
| 59 | 14 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 60 | 14 | my ($orig, $self) = @_; | |||||||||||||||||||||||||||
| 61 | 14 | my $config = $self->$orig; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 14 | my $dist_root = path($self->zilla->root)->realpath; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 14 | ▶ | $config->{+__PACKAGE__} = { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 66 | include_authors => $self->include_authors ? 1 : 0, | ||||||||||||||||||||||||||||
| 67 | include_releaser => $self->include_releaser ? 1 : 0, | ||||||||||||||||||||||||||||
| 68 | order_by => $self->order_by, | ||||||||||||||||||||||||||||
| 69 | paths => [ sort $self->paths ], | ||||||||||||||||||||||||||||
| 70 | $self->remove ? ( remove => '...' ) : (), | ||||||||||||||||||||||||||||
| 71 | git_version => $self->_git('version'), | ||||||||||||||||||||||||||||
| 72 | blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), | ||||||||||||||||||||||||||||
| 73 | }; | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 14 | return $config; | |||||||||||||||||||||||||||
| 76 | 19 | }; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub metadata | ||||||||||||||||||||||||||||
| 79 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
metadata: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | 20 | my $self = shift; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 20 | my $contributors = $self->_contributors; | |||||||||||||||||||||||||||
| 83 | 20 | ▶ | return if not @$contributors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 17 | $self->_check_podweaver; | |||||||||||||||||||||||||||
| 86 | 17 | +{ x_contributors => $contributors }; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | sub register_prereqs | ||||||||||||||||||||||||||||
| 90 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_prereqs: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 91 | 20 | my $self = shift; | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 20 | ▶ | return if none { /[^[:ascii:]]/ } @{ $self->_contributors }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 2 | my $prereqs = $self->zilla->prereqs; | |||||||||||||||||||||||||||
| 96 | 2 | my $all_prereqs = $prereqs->requirements_for(qw(runtime requires)) | |||||||||||||||||||||||||||
| 97 | ->clone | ||||||||||||||||||||||||||||
| 98 | ->add_requirements($prereqs->requirements_for(qw(configure requires))) | ||||||||||||||||||||||||||||
| 99 | ->add_requirements($prereqs->requirements_for(qw(build requires))) | ||||||||||||||||||||||||||||
| 100 | ->add_requirements($prereqs->requirements_for(qw(test requires))) | ||||||||||||||||||||||||||||
| 101 | ->as_string_hash; | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 2 | my $perl_prereq = $all_prereqs->{perl}; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 2 | ▶ | $self->log_debug([ 'found non-ascii characters in contributor names; perl prereq so far is %s', | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | defined $perl_prereq ? $perl_prereq : 'unknown' ]); | ||||||||||||||||||||||||||||
| 107 | 2 | ▶ | $perl_prereq = 0 if not defined $perl_prereq; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 2 | $perl_prereq = version->parse($perl_prereq)->numify; | |||||||||||||||||||||||||||
| 109 | 2 | ▶ | return if "$perl_prereq" >= '5.008006'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | # many Dist::Zilla-using distributions don't have an explicit minimum | ||||||||||||||||||||||||||||
| 112 | # perl, but we know that Dist::Zilla doesn't work until 5.8.7 | ||||||||||||||||||||||||||||
| 113 | 1 | ▶ | return if any { /^Dist::Zilla/ } keys %$all_prereqs; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # if dynamic_config is set, the user gets another chance to read the file, via fallback code: | ||||||||||||||||||||||||||||
| 116 | # < haarg> eumm loads META, updates prereqs, and writes out MYMETA | ||||||||||||||||||||||||||||
| 117 | # < haarg> so in a working system, x_contributors will be included | ||||||||||||||||||||||||||||
| 118 | # < haarg> in a broken system, it will fail to load META, regenerate it from parameters including META_ADD/MERGE, then write it out | ||||||||||||||||||||||||||||
| 119 | # < haarg> so if there isn't any utf8 data in the parameters given to EUMM, it will produce a file that can be read by a "bad" JSON::PP | ||||||||||||||||||||||||||||
| 120 | 1 | ▶ | return if $self->zilla->distmeta->{dynamic_config}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | # see https://github.com/makamaka/JSON-PP/pull/9 for for details | ||||||||||||||||||||||||||||
| 123 | 1 | $self->log('Warning: distribution has non-ascii characters in contributor names. META.json will be unparsable on perls <= 5.8.6 when JSON::PP is lower than 2.27300'); | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 1 | $self->zilla->register_prereqs( | |||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||
| 127 | phase => 'configure', | ||||||||||||||||||||||||||||
| 128 | type => 'suggests', | ||||||||||||||||||||||||||||
| 129 | }, | ||||||||||||||||||||||||||||
| 130 | 'JSON::PP' => '2.27300', | ||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | # should not be called before the MetaProvider phase | ||||||||||||||||||||||||||||
| 135 | 19 | has _contributors => ( | |||||||||||||||||||||||||||
| 136 | is => 'ro', isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 137 | lazy => 1, | ||||||||||||||||||||||||||||
| 138 | builder => '_build_contributors', | ||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | sub _build_contributors | ||||||||||||||||||||||||||||
| 142 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_build_contributors: called CC=14 SCAR=26.5
| |||||||||||||||||||||||||||||
| 143 | 20 | my $self = shift; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | # note that ->status does something different. | ||||||||||||||||||||||||||||
| 146 | 20 | ▶ | return [] if not $self->_git(RUN => 'status'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 19 | my @data = $self->_git(shortlog => | |||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||
| 150 | email => 1, | ||||||||||||||||||||||||||||
| 151 | summary => 1, | ||||||||||||||||||||||||||||
| 152 | numbered => 1, | ||||||||||||||||||||||||||||
| 153 | }, | ||||||||||||||||||||||||||||
| 154 | 'HEAD', '--', $self->paths, | ||||||||||||||||||||||||||||
| 155 | ); | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | # [ count, email ] | ||||||||||||||||||||||||||||
| 158 | 19 | my @counts_and_contributors = map [ split ' ', $_, 2 ], @data; | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | my $fc = "$]" >= '5.016001' | ||||||||||||||||||||||||||||
| 161 | ? \&CORE::fc | ||||||||||||||||||||||||||||
| 162 | 19 | ▶ | : do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | $self->log_debug('case-folding not available; falling back to lower-cased comparisons'); | |||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub { lc $_[0] } # not callable via \&CORE::lc | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 165 | 0 | }; | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 19 | my %seen_email; | |||||||||||||||||||||||||||
| 168 | 19 | ++$seen_email{$fc->(($_->[1] =~ /<([^>]+)>/g)[-1])} foreach @counts_and_contributors; | |||||||||||||||||||||||||||
| 169 | 19 | ▶ | if (my @duplicate_emails = grep $seen_email{$_} > 1, keys %seen_email) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 3 | $self->log('multiple names with the same email found: you may want to use a .mailmap file (https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html#_mapping_authors):', | |||||||||||||||||||||||||||
| 171 | join("\n", '', map ' '.$_, @duplicate_emails)); | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 19 | my %seen_name; | |||||||||||||||||||||||||||
| 175 | 19 | ++$seen_name{$fc->(($_->[1] =~ /^([^<]+) </g)[-1])} foreach @counts_and_contributors; | |||||||||||||||||||||||||||
| 176 | 19 | ▶ | if (my @duplicate_names = grep $seen_name{$_} > 1, keys %seen_name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 3 | $self->log('multiple emails with the same name found: you may want to use a .mailmap file (https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html#_mapping_authors):', | |||||||||||||||||||||||||||
| 178 | join("\n", '', map ' '.$_, @duplicate_names)); | ||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | # remove duplicates by email address, keeping the first associated name | ||||||||||||||||||||||||||||
| 182 | 19 | ▶ | @counts_and_contributors = uniq_by { $fc->(($_->[1] =~ /<([^>]+)>/g)[-1]) } @counts_and_contributors; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | # sort by name (ascending) or count (descending) depending on choice | ||||||||||||||||||||||||||||
| 185 | 19 | my $Collator = Unicode::Collate->new(level => 1); | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | my $sort_sub = | ||||||||||||||||||||||||||||
| 188 | 46 | ▶ | $self->order_by eq 'name' ? sub { $Collator->cmp($a->[1], $b->[1]) } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 189 | 1 | ▶ | : $self->order_by eq 'commits' ? sub { $b->[0] <=> $a->[0] || $Collator->cmp($a->[1], $b->[1]) } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 19 | ▶ | : die 'unrecognized option order_by=', $self->order_by; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 19 | my @contributors = | |||||||||||||||||||||||||||
| 193 | map $_->[1], | ||||||||||||||||||||||||||||
| 194 | sort $sort_sub | ||||||||||||||||||||||||||||
| 195 | @counts_and_contributors; | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | $self->log_debug([ 'extracted contributors from git: %s', | ||||||||||||||||||||||||||||
| 198 | 19 | ▶ | sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 199 | 19 | require Data::Dumper; | |||||||||||||||||||||||||||
| 200 | 19 | chomp(my $str = Data::Dumper->new([ \@contributors ])->Indent(2)->Terse(1)->Dump); | |||||||||||||||||||||||||||
| 201 | 19 | $str; | |||||||||||||||||||||||||||
| 202 | 19 | } ]); | |||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 19 | ▶ | if (not $self->include_authors) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | { | ||||||||||||||||||||||||||||
| 206 | 15 | ▶ | my @authors = eval { Dist::Zilla->VERSION('7.000') } ? $self->zilla->authors : @{ $self->zilla->authors }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 15 | my @author_emails = map /(<[^>]+>)/g, @authors; | |||||||||||||||||||||||||||
| 209 | @contributors = grep { | ||||||||||||||||||||||||||||
| 210 | 15 | my $contributor = $_; | |||||||||||||||||||||||||||
| 211 | 31 | ▶ | none { $contributor =~ /\Q$_\E/i } @author_emails; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 212 | } @contributors; | ||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 19 | ▶ | if (not $self->include_releaser and my $releaser = $self->_releaser) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $self->include_releaser and my $releaser = $self->_releaser
MC/DC100%2/2
not $self->include_releaser and my $releaser = $self->_releaser
not $self->include_releaser
my $releaser = $self->_releaser
Truth table100%3/3
not(A) and B
A= not $self->include_releaserB= my $releaser = $self->_releaser
| |||||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||
| 217 | 4 | @contributors = grep $fc->($_) ne $fc->($releaser), @contributors; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 19 | ▶ | if ($self->remove) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | { | ||||||||||||||||||||||||||||
| 222 | @contributors = grep { | ||||||||||||||||||||||||||||
| 223 | 1 | ▶ | my $contributor = $_; none { $contributor =~ /$_/u } $self->remove | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 224 | } @contributors; | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 19 | return \@contributors; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | sub _releaser | ||||||||||||||||||||||||||||
| 231 | 7 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_releaser: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 232 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 7 | my ($username, $email); | |||||||||||||||||||||||||||
| 235 | 7 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 236 | 7 | ($username) = $self->_git(config => 'user.name'); | |||||||||||||||||||||||||||
| 237 | 7 | ($email) = $self->_git(config => 'user.email'); | |||||||||||||||||||||||||||
| 238 | 7 | }; | |||||||||||||||||||||||||||
| 239 | 7 | ▶ | if (not $username or not $email) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$username and $email
MC/DC50%1/2
$username and $email
$username
$email
Truth table66%2/3
A and B
A= $usernameB= $email
| |||||||||||||||||||||||||||||
| 240 | { | ||||||||||||||||||||||||||||
| 241 | 1 | $self->log('could not extract user.name and user.email configs from git'); | |||||||||||||||||||||||||||
| 242 | 1 | return; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | 6 | $username . ' <' . $email . '>'; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | sub _check_podweaver | ||||||||||||||||||||||||||||
| 248 | 17 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_check_podweaver: called CC=3 SCAR=15.0
| |||||||||||||||||||||||||||||
| 249 | 17 | my $self = shift; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | # check if the module is loaded, not just that it is installed | ||||||||||||||||||||||||||||
| 252 | $self->log('WARNING! You appear to be using Pod::Weaver::Section::Contributors, but it is not new enough to take data directly from distmeta. Upgrade to version 0.008!') | ||||||||||||||||||||||||||||
| 253 | 0 | if eval { Pod::Weaver::Section::Contributors->VERSION(0); 1 } | |||||||||||||||||||||||||||
| 254 | 0 | ▶ | and not eval { Pod::Weaver::Section::Contributors->VERSION(0.007001); 1 }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION(0);
1
}
} and not eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION("0.007001");
1
}
}
MC/DC0%0/2
eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION(0);
1
}
} and not eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION("0.007001");
1
}
}
eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION(0);
1
}
}
not eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION("0.007001");
1
}
}
Truth table33%1/3
A and not(B)
A= eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION(0);
1
}
}B= not eval {
do {
"Pod::Weaver::Section::Contributors"->VERSION("0.007001");
1
}
}
| |||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | has __git => ( | ||||||||||||||||||||||||||||
| 258 | is => 'ro', | ||||||||||||||||||||||||||||
| 259 | isa => 'Git::Wrapper', | ||||||||||||||||||||||||||||
| 260 | lazy => 1, | ||||||||||||||||||||||||||||
| 261 | 20 | ▶ | default => sub { Git::Wrapper->new(path(shift->zilla->root)->absolute->stringify) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 262 | 19 | ); | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | sub _git | ||||||||||||||||||||||||||||
| 265 | 67 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_git: called CC=5 SCAR=16.9
| |||||||||||||||||||||||||||||
| 266 | 67 | my ($self, $command, @args) = @_; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 67 | ▶ | die 'no command?!' if not $command; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 67 | my $git = $self->__git; | |||||||||||||||||||||||||||
| 270 | 67 | ▶ | my @result = try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 271 | 67 | $git->$command(@args); | |||||||||||||||||||||||||||
| 272 | 4 | ▶ | } catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||
| 273 | 4 | ▶ | $self->log(blessed($_) && $_->isa('Git::Wrapper::Exception') ? $_->error : $_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($_) and $_->isa("Git::Wrapper::Exception")
MC/DC0%0/2
builtin::blessed($_) and $_->isa("Git::Wrapper::Exception")
builtin::blessed($_)
$_->isa("Git::Wrapper::Exception")
Truth table33%1/3
A and B
A= builtin::blessed($_)B= $_->isa("Git::Wrapper::Exception")
| |||||||||||||||||||||||||||||
| 274 | 4 | (); | |||||||||||||||||||||||||||
| 275 | 67 | }; | |||||||||||||||||||||||||||
| 276 | 67 | my $err = $git->ERR; | |||||||||||||||||||||||||||
| 277 | 67 | ▶ | $self->log(@$err) if $err and @$err; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$err and @$err
MC/DC0%0/2
$err and @$err
$err
@$err
Truth table66%2/3
A and B
A= $errB= @$err
| |||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | # TODO Git::Wrapper should really be decoding this for us, via a new | ||||||||||||||||||||||||||||
| 280 | # (defaulting-to-false) utf8 flag | ||||||||||||||||||||||||||||
| 281 | 67 | utf8::decode($_) foreach @result; | |||||||||||||||||||||||||||
| 282 | 67 | return @result; | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 19 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | __END__ | ||||||||||||||||||||||||||||