| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
2
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PodLoom; |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Copyright 2009 Christopher J. Madsen |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Author: Christopher J. Madsen <perl@cjmweb.net> |
|
7
|
|
|
|
|
|
|
# Created: 7 Oct 2009 |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
10
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
13
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the |
|
15
|
|
|
|
|
|
|
# GNU General Public License or the Artistic License for more details. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# ABSTRACT: Process module documentation through Pod::Loom |
|
18
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '5.00'; |
|
21
|
|
|
|
|
|
|
# This file is part of Dist-Zilla-Plugin-PodLoom 5.00 (November 13, 2013) |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
711553
|
use Moose 0.65; # attr fulfills requires |
|
|
2
|
|
|
|
|
344776
|
|
|
|
2
|
|
|
|
|
14
|
|
|
25
|
2
|
|
|
2
|
|
11840
|
use Moose::Autobox; |
|
|
2
|
|
|
|
|
291399
|
|
|
|
2
|
|
|
|
|
16
|
|
|
26
|
|
|
|
|
|
|
with(qw(Dist::Zilla::Role::FileMunger |
|
27
|
|
|
|
|
|
|
Dist::Zilla::Role::ModuleInfo |
|
28
|
|
|
|
|
|
|
Dist::Zilla::Role::FileFinderUser) => { |
|
29
|
|
|
|
|
|
|
default_finders => [ ':InstallModules' ], |
|
30
|
|
|
|
|
|
|
}, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# List minimum versions for AutoPrereqs: |
|
34
|
2
|
|
|
2
|
|
1048
|
use 5.008; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
62
|
|
|
35
|
2
|
|
|
2
|
|
743
|
use Dist::Zilla 4.200001 (); # abstract_from_file change |
|
|
2
|
|
|
|
|
725884
|
|
|
|
2
|
|
|
|
|
102
|
|
|
36
|
2
|
|
|
2
|
|
1349
|
use Dist::Zilla::Role::ModuleInfo 0.08 (); # from Plugins, not PluginBundle |
|
|
2
|
|
|
|
|
39289
|
|
|
|
2
|
|
|
|
|
59
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
2
|
|
|
2
|
|
1090
|
use Hash::Merge::Simple (); |
|
|
2
|
|
|
|
|
728
|
|
|
|
2
|
|
|
|
|
42
|
|
|
39
|
2
|
|
|
2
|
|
879
|
use Pod::Loom 0.05 (); # bugtracker |
|
|
2
|
|
|
|
|
215082
|
|
|
|
2
|
|
|
|
|
1115
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has template => ( |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
isa => 'Str', |
|
45
|
|
|
|
|
|
|
default => 'Default', |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has data_file => ( |
|
50
|
|
|
|
|
|
|
is => 'ro', |
|
51
|
|
|
|
|
|
|
isa => 'Str', |
|
52
|
|
|
|
|
|
|
init_arg => 'data', |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has data => ( |
|
56
|
|
|
|
|
|
|
is => 'ro', |
|
57
|
|
|
|
|
|
|
isa => 'HashRef', |
|
58
|
|
|
|
|
|
|
init_arg => undef, |
|
59
|
|
|
|
|
|
|
lazy => 1, |
|
60
|
|
|
|
|
|
|
builder => '_initialize_data', |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has loom => ( |
|
64
|
|
|
|
|
|
|
is => 'ro', |
|
65
|
|
|
|
|
|
|
isa => 'Pod::Loom', |
|
66
|
|
|
|
|
|
|
init_arg => undef, |
|
67
|
|
|
|
|
|
|
lazy => 1, |
|
68
|
|
|
|
|
|
|
default => sub { Pod::Loom->new(template => shift->template) }, |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
72
|
|
|
|
|
|
|
sub _initialize_data |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
1
|
|
|
1
|
|
2
|
my $plugin = shift; |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
33
|
my $fname = $plugin->data_file; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
3
|
return {} unless $fname; |
|
79
|
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
33
|
open my $fh, '<', $fname or die "can't open $fname for reading: $!"; |
|
81
|
1
|
|
|
|
|
2
|
my $code = do { local $/; <$fh> }; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
19
|
|
|
82
|
1
|
|
|
|
|
8
|
close $fh; |
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
2
|
local $@; |
|
85
|
1
|
|
|
|
|
112
|
my $result = eval "package Dist::Zilla::Plugin::PodLoom::_eval; $code"; |
|
86
|
|
|
|
|
|
|
|
|
87
|
1
|
50
|
|
|
|
7
|
die $@ if $@; |
|
88
|
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
33
|
return $result; |
|
90
|
|
|
|
|
|
|
} # end _initialize_data |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
93
|
|
|
|
|
|
|
sub munge_files { |
|
94
|
1
|
|
|
1
|
0
|
52045
|
my ($self) = @_; |
|
95
|
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
7
|
$self->munge_file($_) for $self->found_files->flatten; |
|
97
|
|
|
|
|
|
|
} # end munge_files |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
100
|
|
|
|
|
|
|
sub munge_file |
|
101
|
|
|
|
|
|
|
{ |
|
102
|
1
|
|
|
1
|
0
|
607
|
my ($self, $file) = @_; |
|
103
|
|
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
6
|
my $info = $self->get_module_info($file); |
|
105
|
|
|
|
|
|
|
|
|
106
|
1
|
|
|
|
|
5062
|
my $abstract = Dist::Zilla::Util->abstract_from_file($file); |
|
107
|
1
|
|
|
|
|
4543
|
my $repo = $self->zilla->distmeta->{resources}{repository}; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1
|
50
|
33
|
|
|
23871
|
my $dataHash = Hash::Merge::Simple::merge( |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
{ |
|
111
|
|
|
|
|
|
|
($abstract ? (abstract => $abstract) : ()), |
|
112
|
|
|
|
|
|
|
authors => $self->zilla->authors, |
|
113
|
|
|
|
|
|
|
dist => $self->zilla->name, |
|
114
|
|
|
|
|
|
|
license_notice => $self->zilla->license->notice, |
|
115
|
|
|
|
|
|
|
($info->name ? (module => $info->name) : ()), |
|
116
|
|
|
|
|
|
|
bugtracker => $self->zilla->distmeta->{resources}{bugtracker}, |
|
117
|
|
|
|
|
|
|
repository => $repo->{web} || $repo->{url}, |
|
118
|
|
|
|
|
|
|
# Have to stringify version object: |
|
119
|
|
|
|
|
|
|
($info->version ? (version => q{} . $info->version) : ()), |
|
120
|
|
|
|
|
|
|
zilla => $self->zilla, |
|
121
|
|
|
|
|
|
|
}, $self->data, |
|
122
|
|
|
|
|
|
|
); |
|
123
|
|
|
|
|
|
|
|
|
124
|
1
|
50
|
|
|
|
54
|
my $method = Dist::Zilla->VERSION < 5 ? 'content' : 'encoded_content'; |
|
125
|
|
|
|
|
|
|
|
|
126
|
1
|
|
|
|
|
8
|
my $content = $file->$method; |
|
127
|
|
|
|
|
|
|
|
|
128
|
1
|
|
|
|
|
113
|
$file->$method( $self->loom->weave(\$content, $file->name, $dataHash) ); |
|
129
|
|
|
|
|
|
|
|
|
130
|
1
|
|
|
|
|
153952
|
return; |
|
131
|
|
|
|
|
|
|
} # end munge_file |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
134
|
|
|
|
|
|
|
around dump_config => sub { |
|
135
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
|
136
|
|
|
|
|
|
|
my $config = $self->$orig; |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$config->{'Pod::Loom version'} = Pod::Loom->VERSION; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
return $config; |
|
141
|
|
|
|
|
|
|
}; # end dump_config |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
144
|
2
|
|
|
2
|
|
16
|
no Moose; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
12
|
|
|
145
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
146
|
|
|
|
|
|
|
1; |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
__END__ |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 NAME |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PodLoom - Process module documentation through Pod::Loom |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 VERSION |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This document describes version 5.00 of |
|
157
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PodLoom, released November 13, 2013 |
|
158
|
|
|
|
|
|
|
as part of Dist-Zilla-Plugin-PodLoom version 5.00. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
In your F<dist.ini>: |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
[PodLoom] |
|
165
|
|
|
|
|
|
|
template = Default ; this is the default |
|
166
|
|
|
|
|
|
|
data = loom.pl ; there is no default for this |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
If included, this plugin will process each F<.pm> and F<.pod> file |
|
171
|
|
|
|
|
|
|
under F<lib> or in the root directory through Pod::Loom. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 data |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Since Pod::Loom templates may want configuration that doesn't fit in |
|
178
|
|
|
|
|
|
|
an INI file, you can specify a file containing Perl code to evaluate. |
|
179
|
|
|
|
|
|
|
The result should be a hash reference, which will be passed to |
|
180
|
|
|
|
|
|
|
Pod::Loom's C<weave> method. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
PodLoom automatically includes the following keys, which will be |
|
183
|
|
|
|
|
|
|
merged with the hashref from your code. (Your code can override these |
|
184
|
|
|
|
|
|
|
values.) |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=over |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item abstract |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
The abstract for the file being processed (if it can be determined) |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item authors |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
C<< $zilla->authors >> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item dist |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
C<< $zilla->name >> |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item license_notice |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
C<< $zilla->license->notice >> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item module |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
The primary package of the file being processed |
|
207
|
|
|
|
|
|
|
(if Module::Build::ModuleInfo could determine it) |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item repository |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
C<< $zilla->distmeta->{resources}{repository}{web} >> |
|
212
|
|
|
|
|
|
|
(or the C<url> key if C<web> is not set) |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item version |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
The version number of the file being processed |
|
217
|
|
|
|
|
|
|
(if Module::Build::ModuleInfo could determine it) |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item zilla |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
The Dist::Zilla object itself |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=back |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=for Pod::Coverage |
|
227
|
|
|
|
|
|
|
munge_files? |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 finder |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This is the name of a L<FileFinder|Dist::Zilla::Role::FileFinder> |
|
232
|
|
|
|
|
|
|
whose files will be processed by L<Pod::Loom>. It may be specified |
|
233
|
|
|
|
|
|
|
multiple times. The default value is C<:InstallModules>. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 template |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This will be passed to Pod::Loom as its C<template>. |
|
239
|
|
|
|
|
|
|
Defaults to C<Default>. |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
None reported. |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
No bugs have been reported. |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head1 AUTHOR |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Christopher J. Madsen S<C<< <perl AT cjmweb.net> >>> |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Please report any bugs or feature requests |
|
254
|
|
|
|
|
|
|
to S<C<< <bug-Dist-Zilla-Plugin-PodLoom AT rt.cpan.org> >>> |
|
255
|
|
|
|
|
|
|
or through the web interface at |
|
256
|
|
|
|
|
|
|
L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugin-PodLoom >>. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
You can follow or contribute to Dist-Zilla-Plugin-PodLoom's development at |
|
259
|
|
|
|
|
|
|
L<< https://github.com/madsen/dist-zilla-plugin-podloom >>. |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Christopher J. Madsen. |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
266
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
|
271
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
|
272
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
|
273
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
|
274
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
275
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
|
276
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
|
277
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
|
278
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
281
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
|
282
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE |
|
283
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
|
284
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
|
285
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
|
286
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
|
287
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
|
288
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
289
|
|
|
|
|
|
|
SUCH DAMAGES. |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |