]> Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Pod/Weaver/PluginBundle/Author/CCM.pm
require at least perl 5.14.0
[chaz/p5-Dist-Zilla-PluginBundle-Author-CCM] / lib / Pod / Weaver / PluginBundle / Author / CCM.pm
1 package Pod::Weaver::PluginBundle::Author::CCM;
2 # ABSTRACT: A plugin bundle for pod woven by CCM
3
4 =head1 SYNOPSIS
5
6 # In your weaver.ini file:
7 [@Author::CCM]
8
9 # In your dist.ini file:
10 [PodWeaver]
11 config_plugin = @Author::CCM
12
13 =head1 DESCRIPTION
14
15 You probably don't want to use this.
16
17 =head1 SEE ALSO
18
19 =for :list
20 * L<Pod::Weaver>
21 * L<Pod::Weaver::PluginBundle::Author::ETHER>
22
23 =head1 CREDITS
24
25 This module was heavily inspired by Karen Etheridge's config.
26
27 =cut
28
29 use 5.008;
30 use warnings;
31 use strict;
32
33 our $VERSION = '999.999'; # VERSION
34
35 use Pod::Weaver::Config::Assembler;
36 use namespace::autoclean;
37
38 =method configure
39
40 Returns the configuration in a form similar to what one might use with
41 L<Dist::Zilla::Role::PluginBundle::Easy/add_plugins>.
42
43 =cut
44
45 sub configure {
46 return (
47 ['-EnsurePod5'],
48 ['-H1Nester'],
49 ['-SingleEncoding'],
50
51 ['-Transformer' => List => {transformer => 'List'}],
52 ['-Transformer' => Verbatim => {transformer => 'Verbatim'}],
53
54 ['Region' => 'header'],
55
56 'Name',
57 # ['Badges' => {badge => [qw(perl travis coverage)], formats => 'html, markdown'}],
58
59 'Version',
60
61 ['Region' => 'prelude'],
62
63 ['Generic' => 'SYNOPSIS'],
64 ['Generic' => 'DESCRIPTION'],
65 ['Generic' => 'OVERVIEW'],
66 ['Collect' => 'ATTRIBUTES' => {command => 'attr'}],
67 ['Collect' => 'METHODS' => {command => 'method'}],
68 ['Collect' => 'FUNCTIONS' => {command => 'func'}],
69
70 'Leftovers',
71
72 ['Region' => 'postlude'],
73
74 'Bugs',
75 'Authors',
76 'Contributors',
77 'Legal',
78
79 ['Region' => 'footer'],
80 );
81 }
82
83 =method mvp_bundle_config
84
85 Required in order to be a plugin bundle.
86
87 =cut
88
89 sub mvp_bundle_config {
90 my $self = shift || __PACKAGE__;
91
92 return map { $self->_expand_config($_) } $self->configure;
93 }
94
95 sub _exp { Pod::Weaver::Config::Assembler->expand_package($_[0]) }
96
97 sub _expand_config {
98 my $self = shift;
99 my $spec = shift;
100
101 my ($name, $package, $payload);
102
103 if (!ref $spec) {
104 ($name, $package, $payload) = ($spec, $spec, {});
105 }
106 elsif (@$spec == 1) {
107 ($name, $package, $payload) = (@$spec[0,0], {});
108 }
109 elsif (@$spec == 2) {
110 ($name, $package, $payload) = ref $spec->[1] ? @$spec[0,0,1] : (@$spec[1,0], {});
111 }
112 else {
113 ($package, $name, $payload) = @$spec;
114 }
115
116 $name =~ s/^[@=-]//;
117 $package = _exp($package);
118
119 if ($package eq _exp('Region')) {
120 $name = $spec->[1];
121 $payload = {region_name => $spec->[1], %$payload};
122 }
123
124 $name = '@Author::CCM/' . $name if $package ne _exp('Generic') && $package ne _exp('Collect');
125
126 return [$name => $package => $payload];
127 }
128
129 1;
This page took 0.037523 seconds and 4 git commands to generate.