File Coverage

lib/Dist/Zilla/Plugin/Author/KENTNL/CONTRIBUTING.pm
Criterion Covered Total %
statement 22 24 91.6
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 30 32 93.7


line stmt bran cond sub pod time code
1 1     1   646 use 5.006; # our
  1         3  
  1         31  
2 1     1   3 use strict;
  1         1  
  1         24  
3 1     1   3 use warnings;
  1         7  
  1         71  
4              
5             package Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING;
6              
7             our $VERSION = '0.001004';
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   4 use Carp qw( croak );
  1         1  
  1         85  
19 1     1   791 use Path::Tiny qw( path );
  1         12568  
  1         74  
20 1     1   466 use Moose qw( has around extends );
  1         443230  
  1         8  
21 1     1   4951 use Moose::Util::TypeConstraints qw( enum );
  1         2  
  1         7  
22 1     1   622 use Dist::Zilla::Util::ConfigDumper qw( config_dumper );
  0            
  0            
23             use Dist::Zilla::Plugin::GenerateFile::ShareDir 0.006;
24              
25             extends 'Dist::Zilla::Plugin::GenerateFile::ShareDir';
26              
27             my $valid_version_enum = enum [ keys %{$valid_versions} ];
28              
29             no Moose::Util::TypeConstraints;
30              
31              
32              
33              
34              
35              
36              
37              
38              
39              
40              
41             has 'document_version' => (
42             isa => $valid_version_enum,
43             is => 'ro',
44             default => '0.1',
45             );
46              
47             has '+filename' => (
48             lazy => 1,
49             default => sub { 'CONTRIBUTING.pod' },
50             );
51              
52             has '+source_filename' => (
53             lazy => 1,
54             default => sub { 'contributing-' . $_[0]->document_version . '.pod' },
55             );
56              
57             has '+location' => (
58             lazy => 1,
59             default => sub { 'root' },
60             );
61              
62             has '+phase' => (
63             lazy => 1,
64             default => sub { 'build' },
65             );
66              
67             around dump_config => config_dumper( __PACKAGE__, qw( document_version ), );
68              
69             __PACKAGE__->meta->make_immutable;
70             no Moose;
71              
72             1;
73              
74             __END__
75              
76             =pod
77              
78             =encoding UTF-8
79              
80             =head1 NAME
81              
82             Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING - Generates a CONTRIBUTING file for KENTNL's distributions.
83              
84             =head1 VERSION
85              
86             version 0.001004
87              
88             =head1 DESCRIPTION
89              
90             This is a personal Dist::Zilla plug-in that generates a CONTRIBUTING
91             section in my distribution.
92              
93             I would have made something more general, but my head exploded in thinking about it.
94              
95             =head1 ATTRIBUTES
96              
97             =head2 C<document_version>
98              
99             Specify which shared document to deploy
100              
101             Valid values:
102              
103             [0.1]
104              
105             =head1 AUTHOR
106              
107             Kent Fredric <kentnl@cpan.org>
108              
109             =head1 CONTRIBUTOR
110              
111             =for stopwords David Golden
112              
113             David Golden <dagolden@cpan.org>
114              
115             =head1 COPYRIGHT AND LICENSE
116              
117             This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>.
118              
119             This is free software; you can redistribute it and/or modify it under
120             the same terms as the Perl 5 programming language system itself.
121              
122             =cut