| 1 | package Dist::Inkt::Role::WriteCREDITS; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||
| 4 | 1 | our $VERSION = '0.110'; | |||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | with 'Dist::Inkt::Role::RDFModel'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 0 | ▶ | after PopulateMetadata => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||
| 12 | 0 | my $self = shift; | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 0 | my @maint = $self->doap_project->gather_all_maintainers; | |||||||||||||||||||
| 15 | 0 | ▶ | push @{ $self->metadata->{author} ||= [] }, map "$_", @maint if @maint; | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->metadata->{"author"} ||= []
MC/DC0%0/1
$self->metadata->{"author"} ||= []
$self->metadata->{"author"}
Truth table0%0/2
A
A= $self->metadata->{"author"}
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 0 | my %already = map +($_ => 1), @maint; | |||||||||||||||||||
| 18 | 0 | my @contrib = grep !$already{$_}, $self->doap_project->gather_all_contributors; | |||||||||||||||||||
| 19 | 0 | ▶ | push @{ $self->metadata->{x_contributors} ||= [] }, map "$_", @contrib if @contrib; | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->metadata->{"x_contributors"} ||= []
MC/DC0%0/1
$self->metadata->{"x_contributors"} ||= []
$self->metadata->{"x_contributors"}
Truth table0%0/2
A
A= $self->metadata->{"x_contributors"}
| |||||||||||||||||||||
| 20 | 1 | }; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | after BUILD => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||
| 24 | 0 | unshift @{ $self->targets }, 'CREDITS'; | |||||||||||||||||||
| 25 | 1 | }; | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | sub Build_CREDITS | ||||||||||||||||||||
| 28 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
Build_CREDITS: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||
| 29 | 0 | my $self = shift; | |||||||||||||||||||
| 30 | 0 | my $file = $self->targetfile('CREDITS'); | |||||||||||||||||||
| 31 | 0 | ▶ | $file->exists and return $self->log('Skipping %s; it already exists', $file); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 0 | $self->log('Writing %s', $file); | |||||||||||||||||||
| 33 | 0 | ▶ | $self->rights_for_generated_files->{'CREDITS'} ||= [ | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->rights_for_generated_files->{"CREDITS"} ||= ["None", "public-domain"]
MC/DC0%0/1
$self->rights_for_generated_files->{"CREDITS"} ||= ["None", "public-domain"]
$self->rights_for_generated_files->{"CREDITS"}
Truth table0%0/2
A
A= $self->rights_for_generated_files->{"CREDITS"}
| |||||||||||||||||||||
| 34 | 'None', 'public-domain' | ||||||||||||||||||||
| 35 | ] if $self->DOES('Dist::Inkt::Role::WriteCOPYRIGHT'); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | my $fh = $file->openw_utf8; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | my %already; | |||||||||||||||||||
| 40 | 0 | for my $role (qw/ maintainer contributor thanks /) | |||||||||||||||||||
| 41 | { | ||||||||||||||||||||
| 42 | 0 | (my $method = "gather_all_${role}s") =~ s/ss$/s/s; | |||||||||||||||||||
| 43 | my @peeps = | ||||||||||||||||||||
| 44 | 0 | sort { $a->to_string cmp $b->to_string } | |||||||||||||||||||
| 45 | 0 | ▶ | grep { blessed($_) and not $already{$_}++ } | ||||||||||||||||||
|
Condition0%0/3
builtin::blessed($_) && !$already{$_}++
MC/DC0%0/2
builtin::blessed($_) && !$already{$_}++
builtin::blessed($_)
!$already{$_}++
Truth table0%0/3
A && not(B)
A= builtin::blessed($_)B= !$already{$_}++
| |||||||||||||||||||||
| 46 | $self->doap_project->$method; | ||||||||||||||||||||
| 47 | 0 | ▶ | next unless @peeps; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | printf {$fh} ("%s:\n", ucfirst $role); | |||||||||||||||||||
| 50 | 0 | printf {$fh} ("- %s\n", $_->to_string) for @peeps; | |||||||||||||||||||
| 51 | 0 | printf {$fh} ("\n"); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 0 | close($fh); | |||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||