| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::ContributorsFile; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: add a file listing all contributors |
|
4
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::ContributorsFile::VERSION = '0.4.0'; |
|
5
|
1
|
|
|
1
|
|
163987
|
use 5.36.0; |
|
|
1
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
8
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
68
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
738
|
use Moose; |
|
|
1
|
|
|
|
|
583447
|
|
|
|
1
|
|
|
|
|
10
|
|
|
11
|
1
|
|
|
1
|
|
8471
|
use Dist::Zilla::File::InMemory; |
|
|
1
|
|
|
|
|
621871
|
|
|
|
1
|
|
|
|
|
619
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with qw/ |
|
14
|
|
|
|
|
|
|
Dist::Zilla::Role::Plugin |
|
15
|
|
|
|
|
|
|
Dist::Zilla::Role::FileGatherer |
|
16
|
|
|
|
|
|
|
Dist::Zilla::Role::FileMunger |
|
17
|
|
|
|
|
|
|
Dist::Zilla::Role::FilePruner |
|
18
|
|
|
|
|
|
|
Dist::Zilla::Role::TextTemplate |
|
19
|
|
|
|
|
|
|
/; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has filename => ( |
|
22
|
|
|
|
|
|
|
is => 'ro', |
|
23
|
|
|
|
|
|
|
default => 'CONTRIBUTORS', |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has contributors => ( |
|
27
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
28
|
|
|
|
|
|
|
isa => 'ArrayRef', |
|
29
|
|
|
|
|
|
|
lazy => 1, |
|
30
|
|
|
|
|
|
|
default => sub($self) { |
|
31
|
|
|
|
|
|
|
return [ map { |
|
32
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ContributorsFile::Contributor->new($_) |
|
33
|
|
|
|
|
|
|
} @{ $self->zilla->distmeta->{x_contributors} || [] } |
|
34
|
|
|
|
|
|
|
]; |
|
35
|
|
|
|
|
|
|
}, |
|
36
|
|
|
|
|
|
|
handles => { |
|
37
|
|
|
|
|
|
|
has_contributors => 'count', |
|
38
|
|
|
|
|
|
|
all_contributors => 'elements', |
|
39
|
|
|
|
|
|
|
}, |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
0
|
|
sub munge_file($self,$file) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return unless $file->name eq $self->filename; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
return $self->log( 'no contributor detected, skipping file' ) |
|
47
|
|
|
|
|
|
|
unless $self->has_contributors; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$file->content( $self->fill_in_string( |
|
50
|
|
|
|
|
|
|
$file->content, { |
|
51
|
|
|
|
|
|
|
distribution => uc $self->zilla->name, |
|
52
|
|
|
|
|
|
|
contributors => [ $self->all_contributors ], |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
)); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
0
|
|
sub gather_files($self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->add_file( |
|
60
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new({ |
|
61
|
|
|
|
|
|
|
content => $self->contributors_template, |
|
62
|
|
|
|
|
|
|
name => $self->filename, |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
) |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
0
|
|
sub prune_files($self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
return if $self->has_contributors; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->log( 'no contributors, pruning file' ); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$self->zilla->prune_file($_) |
|
75
|
0
|
|
|
|
|
|
for grep { $_->name eq $self->filename } $self->zilla->files->@*; |
|
|
0
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub contributors_template { |
|
80
|
0
|
|
|
0
|
0
|
|
return <<'END_CONT'; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# {{$distribution}} CONTRIBUTORS # |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is the (likely incomplete) list of people who have helped |
|
85
|
|
|
|
|
|
|
make this distribution what it is, either via code contributions, |
|
86
|
|
|
|
|
|
|
patches, bug reports, help with troubleshooting, etc. A huge |
|
87
|
|
|
|
|
|
|
'thank you' to all of them. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
{{ |
|
90
|
|
|
|
|
|
|
for my $contributor ( @contributors ) { |
|
91
|
|
|
|
|
|
|
$OUT .= sprintf " * %s\n", $contributor->name; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
}} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
END_CONT |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
100
|
1
|
|
|
1
|
|
14
|
no Moose; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
package |
|
103
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ContributorsFile::Contributor; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
use overload |
|
106
|
1
|
|
|
1
|
|
409
|
'""' => sub { sprintf "%s <%s>", @$_ }; |
|
|
1
|
|
|
0
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
|
0
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
0
|
|
|
sub new($class,@rest) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my @self; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
if( @rest == 2 ) { |
|
113
|
0
|
|
|
|
|
|
@self = @rest; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
else { |
|
116
|
0
|
|
|
|
|
|
@self = $rest[0] =~ /^\s*(.*?)\s*<(.*?)>\s*$/ |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
return bless \@self, $class; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
|
|
0
|
|
|
sub name { $_[0][0] } |
|
123
|
0
|
|
|
0
|
|
|
sub email { $_[0][1] } |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=pod |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=encoding UTF-8 |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 NAME |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ContributorsFile - add a file listing all contributors |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 VERSION |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
version 0.4.0 |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
In dist.ini: |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
" any plugin populating x_contributors in the META files |
|
147
|
|
|
|
|
|
|
[Git::Contributors] |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
[ContributorsFile] |
|
150
|
|
|
|
|
|
|
filename = CONTRIBUTORS |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
C<Dist::Zilla::Plugin::ContributorsFile> populates a I<CONTRIBUTORS> file |
|
155
|
|
|
|
|
|
|
with all the contributors of the project as found under the |
|
156
|
|
|
|
|
|
|
I<x_contributors> key in the META files. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
The generated file will look like this: |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# FOO-BAR CONTRIBUTORS # |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This is the (likely incomplete) list of people who have helped |
|
163
|
|
|
|
|
|
|
make this distribution what it is, either via code contributions, |
|
164
|
|
|
|
|
|
|
patches, bug reports, help with troubleshooting, etc. A huge |
|
165
|
|
|
|
|
|
|
'thank you' to all of them. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
* Albert Zoot |
|
168
|
|
|
|
|
|
|
* Bertrand Maxwell |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Note that if no contributors beside the actual author(s) are found, |
|
171
|
|
|
|
|
|
|
the file will not be created. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 CONFIGURATION OPTIONS |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 filename |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
The name of the contributor file that is created. Defaults to I<CONTRIBUTORS>. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 TRICKS |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Refer to David Golden's blog entry at |
|
182
|
|
|
|
|
|
|
L<http://www.dagolden.com/index.php/1921/how-im-using-distzilla-to-give-credit-to-contributors/> |
|
183
|
|
|
|
|
|
|
to get introduced to the C<Dist::Zilla> contributor modules. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Git's C<.mailmap> file is useful to deal with contributors with several email |
|
186
|
|
|
|
|
|
|
addresses: |
|
187
|
|
|
|
|
|
|
L<https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html>. |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
To give credit to bug reporters and other persons who don't commit code |
|
190
|
|
|
|
|
|
|
directly, you can use empty git commits: |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
git commit --allow-empty --author="David Golden <dagolden@cpan.org>" -m "..." |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
To populate the META file with the C<x_contributors>, you probably want to use |
|
195
|
|
|
|
|
|
|
either L<Dist::Zilla::Plugin::Git::Contributors> or |
|
196
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::ContributorsFromGit>. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::ContributorsFromGit> |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Git::Contributors> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
L<Pod::Weaver::Section::Contributors> |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 AUTHOR |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This software is copyright (c) 2026 by Yanick Champoux. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
215
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |