File Coverage

lib/Dist/Zilla/Plugin/Author/KENTNL/CONTRIBUTING.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 35 35 100.0


line stmt bran cond sub pod time code
1 1     1   932 use 5.006; # our
  1         3  
2 1     1   5 use strict;
  1         1  
  1         21  
3 1     1   4 use warnings;
  1         9  
  1         159  
4              
5             package Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING;
6              
7             our $VERSION = '0.001005';
8              
9             # ABSTRACT: Generates a CONTRIBUTING file for KENTNL's distributions.
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13             # NB: This list is intentionally short, because these are API-versions
14             # describing which document to fetch, and certain documents will update
15             # without changing their API version
16             my $valid_versions = { map { $_ => 1 } qw( 0.1 ) };
17              
18 1     1   831 use Moose qw( has around extends );
  1         465853  
  1         7  
19 1     1   5988 use Moose::Util::TypeConstraints qw( enum );
  1         2  
  1         11  
20 1     1   1423 use Dist::Zilla::Util::ConfigDumper qw( config_dumper );
  1         1235  
  1         6  
21 1     1   1022 use Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.006;
  1         673399  
  1         91  
22              
23             extends 'Dist::Zilla::Plugin::GenerateFile::FromShareDir';
24              
25             my $valid_version_enum = enum [ keys %{$valid_versions} ];
26              
27 1     1   9 no Moose::Util::TypeConstraints;
  1         2  
  1         9  
28              
29              
30              
31              
32              
33              
34              
35              
36              
37              
38              
39             has 'document_version' => (
40             isa => $valid_version_enum,
41             is => 'ro',
42             default => '0.1',
43             );
44              
45             has '+filename' => (
46             lazy => 1,
47             default => sub { 'CONTRIBUTING.pod' },
48             );
49              
50             has '+source_filename' => (
51             lazy => 1,
52             default => sub { 'contributing-' . $_[0]->document_version . '.pod' },
53             );
54              
55             has '+location' => (
56             lazy => 1,
57             default => sub { 'root' },
58             );
59              
60             has '+phase' => (
61             lazy => 1,
62             default => sub { 'build' },
63             );
64              
65             around dump_config => config_dumper( __PACKAGE__, qw( document_version ), );
66              
67             __PACKAGE__->meta->make_immutable;
68 1     1   304 no Moose;
  1         2  
  1         6  
69              
70             1;
71              
72             __END__
73              
74             =pod
75              
76             =encoding UTF-8
77              
78             =head1 NAME
79              
80             Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING - Generates a CONTRIBUTING file for KENTNL's distributions.
81              
82             =head1 VERSION
83              
84             version 0.001005
85              
86             =head1 DESCRIPTION
87              
88             This is a personal Dist::Zilla plug-in that generates a CONTRIBUTING
89             section in my distribution.
90              
91             I would have made something more general, but my head exploded in thinking about it.
92              
93             =head1 ATTRIBUTES
94              
95             =head2 C<document_version>
96              
97             Specify which shared document to deploy
98              
99             Valid values:
100              
101             [0.1]
102              
103             =head1 AUTHOR
104              
105             Kent Fredric <kentnl@cpan.org>
106              
107             =head1 CONTRIBUTORS
108              
109             =for stopwords David Golden Karen Etheridge
110              
111             =over 4
112              
113             =item *
114              
115             David Golden <dagolden@cpan.org>
116              
117             =item *
118              
119             Karen Etheridge <ether@cpan.org>
120              
121             =back
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut