File Coverage

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


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