File Coverage

blib/lib/Dist/Zilla/Plugin/HelpWanted.pm
Criterion Covered Total %
statement 28 28 100.0
branch 4 6 66.6
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 39 42 92.8


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::HelpWanted;
2             our $AUTHORITY = 'cpan:YANICK';
3             # ABSTRACT: insert 'Help Wanted' information in the distribution's META
4             $Dist::Zilla::Plugin::HelpWanted::VERSION = '0.3.3';
5              
6 2     2   3748613 use 5.34.0;
  2         8  
7 2     2   13 use warnings;
  2         21  
  2         149  
8              
9 2     2   937 use Moose;
  2         612934  
  2         12  
10 2     2   11598 use List::MoreUtils qw(uniq);
  2         23532  
  2         14  
11              
12 2     2   2445 use experimental qw/ signatures /;
  2         1134  
  2         13  
13              
14             with qw/
15             Dist::Zilla::Role::Plugin
16             Dist::Zilla::Role::InstallTool
17             /;
18              
19             my @positions = qw/
20             maintainer
21             co-maintainer
22             coder
23             translator
24             documentation
25             tester
26             documenter
27             developer
28             helper
29             /;
30              
31             my %legacy = (
32             'co-maintainer' => 'maintainer',
33             'coder' => 'developer',
34             'documentation' => 'documenter',
35             );
36              
37             has [ @positions ] => (
38             is => 'rw',
39             isa => 'Bool',
40             default => 0,
41             );
42              
43             has positions => (
44             is => 'ro',
45             isa => 'Str',
46             default => '',
47             );
48              
49 3     3 0 178478 sub setup_installer($self) {
  3         7  
  3         7  
50              
51 3         133 for my $p ( split ' ', $self->positions ) {
52 8 50       12 eval { $self->$p(1); 1; }
  8         281  
  8         21  
53             or die "position '$p' not recognized\n";
54             }
55              
56             my @open_positions =
57             uniq
58 10 100       60 map { exists($legacy{$_}) ? $legacy{$_} : $_ }
59 3         11 grep { $self->$_ } @positions;
  27         952  
60              
61             $self->zilla->distmeta->{x_help_wanted} = \@open_positions
62 3 50       121 if @open_positions;
63             }
64              
65             __PACKAGE__->meta->make_immutable;
66 2     2   960 no Moose;
  2         4  
  2         26  
67             1;
68              
69             __END__
70              
71             =pod
72              
73             =encoding UTF-8
74              
75             =head1 NAME
76              
77             Dist::Zilla::Plugin::HelpWanted - insert 'Help Wanted' information in the distribution's META
78              
79             =head1 VERSION
80              
81             version 0.3.3
82              
83             =head1 SYNOPSIS
84              
85             In dist.ini:
86              
87             [HelpWanted]
88             positions = maintainer developer translator documenter tester helper
89              
90             or
91              
92             [HelpWanted]
93             maintainer = 1
94             developer = 1
95             translator = 1
96             documenter = 1
97             tester = 1
98             helper = 1
99              
100             =head1 DESCRIPTION
101              
102             C<Dist::Zilla::Plugin::HelpWanted> adds an
103             C<x_help_wanted> field in the META information of the
104             distribution.
105              
106             =head1 CONFIGURATION OPTIONS
107              
108             Position are passed to the plugin either via the
109             option C<positions>, or piecemeal (see example above).
110              
111             The list of possible positions (inspired by
112             L<DOAP|https://github.com/edumbill/doap/wiki>) is:
113              
114             =over
115              
116             =item maintainer
117              
118             =item developer
119              
120             =item translator
121              
122             =item documenter
123              
124             =item tester
125              
126             =item helper
127              
128             =back
129              
130             =head1 AUTHOR
131              
132             Yanick Champoux <yanick@cpan.org>
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2025 by Yanick Champoux.
137              
138             This is free software; you can redistribute it and/or modify it under
139             the same terms as the Perl 5 programming language system itself.
140              
141             =cut