]> Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Pod/Weaver/PluginBundle/Author/CCM.pm
initial commit
[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 warnings;
30 use strict;
31
32 our $VERSION = '999.999'; # VERSION
33
34 use Pod::Weaver::Config::Assembler;
35 use namespace::autoclean;
36
37 =method configure
38
39 Returns the configuration in a form similar to what one might use with
40 L<Dist::Zilla::Role::PluginBundle::Easy/add_plugins>.
41
42 =cut
43
44 sub configure {
45 return (
46 ['-EnsurePod5'],
47 ['-H1Nester'],
48 ['-SingleEncoding'],
49
50 ['-Transformer' => List => {transformer => 'List'}],
51 ['-Transformer' => Verbatim => {transformer => 'Verbatim'}],
52
53 ['Region' => 'header'],
54
55 'Name',
56 # ['Badges' => {badge => [qw(perl travis coverage)], formats => 'html, markdown'}],
57
58 'Version',
59
60 ['Region' => 'prelude'],
61
62 ['Generic' => 'SYNOPSIS'],
63 ['Generic' => 'DESCRIPTION'],
64 ['Generic' => 'OVERVIEW'],
65 ['Collect' => 'ATTRIBUTES' => {command => 'attr'}],
66 ['Collect' => 'METHODS' => {command => 'method'}],
67 ['Collect' => 'FUNCTIONS' => {command => 'func'}],
68
69 'Leftovers',
70
71 ['Region' => 'postlude'],
72
73 'Bugs',
74 'Authors',
75 'Contributors',
76 'Legal',
77
78 ['Region' => 'footer'],
79 );
80 }
81
82 =method mvp_bundle_config
83
84 Required in order to be a plugin bundle.
85
86 =cut
87
88 sub mvp_bundle_config {
89 my $self = shift || __PACKAGE__;
90
91 return map { $self->_expand_config($_) } $self->configure;
92 }
93
94 sub _exp { Pod::Weaver::Config::Assembler->expand_package($_[0]) }
95
96 sub _expand_config {
97 my $self = shift;
98 my $spec = shift;
99
100 my ($name, $package, $payload);
101
102 if (!ref $spec) {
103 ($name, $package, $payload) = ($spec, $spec, {});
104 }
105 elsif (@$spec == 1) {
106 ($name, $package, $payload) = (@$spec[0,0], {});
107 }
108 elsif (@$spec == 2) {
109 ($name, $package, $payload) = ref $spec->[1] ? @$spec[0,0,1] : (@$spec[1,0], {});
110 }
111 else {
112 ($package, $name, $payload) = @$spec;
113 }
114
115 $name =~ s/^[@=-]//;
116 $package = _exp($package);
117
118 if ($package eq _exp('Region')) {
119 $name = $spec->[1];
120 $payload = {region_name => $spec->[1], %$payload};
121 }
122
123 $name = '@Author::CCM/' . $name if $package ne _exp('Generic') && $package ne _exp('Collect');
124
125 return [$name => $package => $payload];
126 }
127
128 1;
This page took 0.034929 seconds and 4 git commands to generate.