line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::TemplateCJM; |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Copyright 2009 Christopher J. Madsen |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Author: Christopher J. Madsen <perl@cjmweb.net> |
7
|
|
|
|
|
|
|
# Created: 24 Sep 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 templates, including version numbers & changes |
18
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '5.000'; |
21
|
|
|
|
|
|
|
# This file is part of Dist-Zilla-Plugin-TemplateCJM 5.000 (December 5, 2015) |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
841964
|
use Moose; |
|
2
|
|
|
|
|
475745
|
|
|
2
|
|
|
|
|
15
|
|
25
|
2
|
|
|
2
|
|
13828
|
use Moose::Util::TypeConstraints; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
21
|
|
26
|
2
|
|
|
2
|
|
4299
|
use List::Util (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5254
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# We operate as an InstallTool instead of a FileMunger because the |
29
|
|
|
|
|
|
|
# prerequisites have not been collected when FileMungers are run. |
30
|
|
|
|
|
|
|
with( |
31
|
|
|
|
|
|
|
'Dist::Zilla::Role::InstallTool', |
32
|
|
|
|
|
|
|
'Dist::Zilla::Role::BeforeRelease', |
33
|
|
|
|
|
|
|
'Dist::Zilla::Role::ModuleInfo', |
34
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
35
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileFinderUser' => { |
36
|
|
|
|
|
|
|
default_finders => [ ':InstallModules' ], |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub mvp_multivalue_args { qw(file) } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has changelog => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => 'Str', |
46
|
|
|
|
|
|
|
default => 'Changes', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
coerce 'RegexpRef', from 'Str', via { qr/$_/ }; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has changelog_re => ( |
53
|
|
|
|
|
|
|
is => 'ro', |
54
|
|
|
|
|
|
|
isa => 'RegexpRef', |
55
|
|
|
|
|
|
|
coerce => 1, |
56
|
|
|
|
|
|
|
default => sub { qr/(\d[\d._]*)\s+(.+)/ }, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
has changes => ( |
61
|
|
|
|
|
|
|
is => 'ro', |
62
|
|
|
|
|
|
|
isa => 'Int', |
63
|
|
|
|
|
|
|
default => 1, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has date_format => ( |
68
|
|
|
|
|
|
|
is => 'ro', |
69
|
|
|
|
|
|
|
isa => 'Str', |
70
|
|
|
|
|
|
|
default => '', |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has template_files => ( |
75
|
|
|
|
|
|
|
is => 'ro', |
76
|
|
|
|
|
|
|
isa => 'ArrayRef', |
77
|
|
|
|
|
|
|
lazy => 1, |
78
|
|
|
|
|
|
|
init_arg => 'file', |
79
|
|
|
|
|
|
|
default => sub { [ 'README' ] }, |
80
|
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
has report_versions => ( |
84
|
|
|
|
|
|
|
is => 'ro', |
85
|
|
|
|
|
|
|
isa => 'Bool', |
86
|
|
|
|
|
|
|
default => 1, |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
90
|
|
|
|
|
|
|
# Main entry point: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub setup_installer { |
93
|
5
|
|
|
5
|
0
|
259151
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
5
|
|
|
|
|
191
|
my $files = $self->zilla->files; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Get release date & changes from Changes file: |
98
|
5
|
|
|
|
|
442
|
my $changelog = $self->changelog; |
99
|
5
|
50
|
|
15
|
|
42
|
my $changesFile = List::Util::first { $_->name eq $changelog } @$files |
|
15
|
|
|
|
|
518
|
|
100
|
|
|
|
|
|
|
or die "No $changelog file\n"; |
101
|
|
|
|
|
|
|
|
102
|
5
|
|
|
|
|
285
|
my ($release_date, $changes, $release_datetime) = $self->check_Changes($changesFile); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Process template_files: |
105
|
5
|
|
|
|
|
198
|
my %data = ( |
106
|
|
|
|
|
|
|
changes => $changes, |
107
|
|
|
|
|
|
|
date => $release_date, |
108
|
|
|
|
|
|
|
datetime=> $release_datetime, |
109
|
|
|
|
|
|
|
dist => $self->zilla->name, |
110
|
|
|
|
|
|
|
meta => $self->zilla->distmeta, |
111
|
|
|
|
|
|
|
t => \$self, |
112
|
|
|
|
|
|
|
version => $self->zilla->version, |
113
|
|
|
|
|
|
|
zilla => \$self->zilla, |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
|
116
|
5
|
|
|
|
|
1177
|
$data{dist_version} = $data{version}; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# The STRICT option hasn't been implemented in a released version of |
119
|
|
|
|
|
|
|
# Text::Template, but you can apply Template_strict.patch. Since |
120
|
|
|
|
|
|
|
# Text::Template ignores unknown options, this code will still work |
121
|
|
|
|
|
|
|
# even if you don't apply the patch; you just won't get strict checking. |
122
|
|
|
|
|
|
|
my %parms = ( |
123
|
|
|
|
|
|
|
STRICT => 1, |
124
|
0
|
|
|
0
|
|
0
|
BROKEN => sub { $self->template_error(@_) }, |
125
|
5
|
|
|
|
|
37
|
); |
126
|
|
|
|
|
|
|
|
127
|
5
|
|
|
|
|
11
|
my %template_file = map {; $_ => 1 } @{ $self->template_files }; |
|
5
|
|
|
|
|
26
|
|
|
5
|
|
|
|
|
225
|
|
128
|
|
|
|
|
|
|
|
129
|
5
|
|
|
|
|
18
|
foreach my $file (@$files) { |
130
|
30
|
100
|
|
|
|
9923
|
next unless $template_file{ $file->name }; |
131
|
5
|
|
|
|
|
277
|
$self->log('Processing ' . $file->name); |
132
|
5
|
|
|
|
|
1810
|
$self->_cur_filename($file->name); |
133
|
5
|
|
|
|
|
229
|
$self->_cur_offset(0); |
134
|
5
|
|
|
|
|
21
|
$self->_store_pathname(\%data, $file); |
135
|
5
|
|
|
|
|
33
|
$file->content($self->fill_in_string($file->content, \%data, \%parms)); |
136
|
|
|
|
|
|
|
} # end foreach $file |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# Munge POD sections in modules: |
139
|
5
|
|
|
|
|
266
|
$files = $self->found_files; |
140
|
|
|
|
|
|
|
|
141
|
5
|
|
|
|
|
5817
|
foreach my $file (@$files) { |
142
|
10
|
|
|
|
|
43
|
$self->munge_file($file, \%data, \%parms); |
143
|
|
|
|
|
|
|
} # end foreach $file |
144
|
|
|
|
|
|
|
} # end setup_installer |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
147
|
|
|
|
|
|
|
# Store pathname and filename in the data hash |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub _store_pathname |
150
|
|
|
|
|
|
|
{ |
151
|
15
|
|
|
15
|
|
33
|
my ($self, $dataRef, $file) = @_; |
152
|
|
|
|
|
|
|
|
153
|
15
|
|
|
|
|
74
|
$dataRef->{pathname} = $dataRef->{filename} = $file->name; |
154
|
15
|
|
|
|
|
962
|
$dataRef->{filename} =~ s!^.*/!!s; # Strip directory names |
155
|
|
|
|
|
|
|
} # end _store_pathname |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
158
|
|
|
|
|
|
|
# Make sure we have a release date: |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
has _release_date => ( |
161
|
|
|
|
|
|
|
is => 'rw', |
162
|
|
|
|
|
|
|
isa => 'Str', |
163
|
|
|
|
|
|
|
init_arg => undef, |
164
|
|
|
|
|
|
|
); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
has _release_datetime => ( |
167
|
|
|
|
|
|
|
is => 'rw', |
168
|
|
|
|
|
|
|
isa => 'DateTime', |
169
|
|
|
|
|
|
|
init_arg => undef, |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub before_release |
173
|
|
|
|
|
|
|
{ |
174
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
175
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
0
|
my $release_date = $self->_release_date; |
177
|
|
|
|
|
|
|
|
178
|
0
|
0
|
0
|
|
|
0
|
$self->log_fatal(["Invalid release date in %s: %s", |
|
|
|
0
|
|
|
|
|
179
|
|
|
|
|
|
|
$self->changelog, $release_date ]) |
180
|
|
|
|
|
|
|
if not $release_date or not $self->_release_datetime or $release_date =~ /^[[:upper:]]+$/; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} # end before_release |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
185
|
|
|
|
|
|
|
# Make sure that we've listed this release in Changes: |
186
|
|
|
|
|
|
|
# |
187
|
|
|
|
|
|
|
# Returns: |
188
|
|
|
|
|
|
|
# A list (release_date, change_text, release_datetime) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub check_Changes |
191
|
|
|
|
|
|
|
{ |
192
|
5
|
|
|
5
|
0
|
11
|
my ($self, $changesFile) = @_; |
193
|
|
|
|
|
|
|
|
194
|
5
|
|
|
|
|
19
|
my $file = $changesFile->name; |
195
|
|
|
|
|
|
|
|
196
|
5
|
|
|
|
|
403
|
my $version = $self->zilla->version; |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
# Get the number of releases to include from Changes: |
199
|
5
|
|
|
|
|
403
|
my $list_releases = $self->changes; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# Read the Changes file and find the line for dist_version: |
202
|
5
|
|
|
|
|
22
|
my $changelog = $changesFile->content; |
203
|
|
|
|
|
|
|
|
204
|
5
|
|
|
|
|
3700
|
my ($release_date, $text); |
205
|
|
|
|
|
|
|
|
206
|
5
|
|
|
|
|
288
|
my $re = $self->changelog_re; |
207
|
|
|
|
|
|
|
|
208
|
5
|
|
|
|
|
45
|
while ($changelog =~ m/(.*\n)/g) { |
209
|
15
|
|
|
|
|
30
|
my $line = $1; |
210
|
15
|
100
|
|
|
|
162
|
if ($line =~ /^$re/) { |
211
|
5
|
50
|
|
|
|
18
|
die "ERROR: $file begins with version $1, expected version $version" |
212
|
|
|
|
|
|
|
unless $1 eq $version; |
213
|
5
|
|
|
|
|
13
|
$release_date = $2; |
214
|
5
|
|
|
|
|
9
|
$text = ''; |
215
|
5
|
|
|
|
|
31
|
while ($changelog =~ m/(.*\n)/g) { |
216
|
15
|
|
|
|
|
32
|
$line = $1; |
217
|
15
|
100
|
66
|
|
|
90
|
last if $line =~ /^\S/ and --$list_releases <= 0; |
218
|
10
|
|
|
|
|
42
|
$text .= $line; |
219
|
|
|
|
|
|
|
} |
220
|
5
|
|
|
|
|
21
|
$text =~ s/\A\s*\n//; # Remove leading blank lines |
221
|
5
|
|
|
|
|
51
|
$text =~ s/\s*\z/\n/; # Normalize trailing whitespace |
222
|
5
|
50
|
|
|
|
20
|
die "ERROR: $file contains no history for version $version" |
223
|
|
|
|
|
|
|
unless length($text) > 1; |
224
|
5
|
|
|
|
|
12
|
last; |
225
|
|
|
|
|
|
|
} # end if found the first version in Changes |
226
|
|
|
|
|
|
|
} # end while more lines in Changes |
227
|
|
|
|
|
|
|
|
228
|
5
|
|
|
|
|
9
|
undef $changelog; |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
# Report the results: |
231
|
5
|
50
|
|
|
|
14
|
die "ERROR: Can't find any versions in $file" unless $release_date; |
232
|
|
|
|
|
|
|
|
233
|
5
|
|
|
|
|
236
|
$self->_release_date($release_date); # Remember it for before_release |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# Try to parse the release date: |
236
|
5
|
|
|
|
|
886
|
require DateTime::Format::Natural; |
237
|
|
|
|
|
|
|
|
238
|
5
|
|
|
|
|
146221
|
my $parser = DateTime::Format::Natural->new( |
239
|
|
|
|
|
|
|
format => 'mm/dd/yy', |
240
|
|
|
|
|
|
|
time_zone => 'local', |
241
|
|
|
|
|
|
|
); |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
# If the date is YYYY-MM-DD with optional time, |
244
|
|
|
|
|
|
|
# you may have a release note after the date. |
245
|
5
|
100
|
|
|
|
59897
|
my $release_datetime = $parser->parse_datetime( |
246
|
|
|
|
|
|
|
$release_date =~ m{ |
247
|
|
|
|
|
|
|
^ ( \d{4}-\d\d-\d\d |
248
|
|
|
|
|
|
|
(?: \s \d\d:\d\d (?: :\d\d)? )? |
249
|
|
|
|
|
|
|
) \b |
250
|
|
|
|
|
|
|
}x ? "$1" : $release_date |
251
|
|
|
|
|
|
|
); |
252
|
|
|
|
|
|
|
|
253
|
5
|
50
|
|
|
|
17656
|
if ($parser->success) { |
254
|
5
|
|
|
|
|
418
|
$self->_release_datetime($release_datetime); # Remember it for before_release |
255
|
|
|
|
|
|
|
} else { |
256
|
0
|
|
|
|
|
0
|
$self->log_debug("Unable to parse '${release_date}'"); |
257
|
0
|
|
|
|
|
0
|
$release_datetime = undef; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
5
|
100
|
66
|
|
|
25
|
if ($release_datetime and $self->date_format) { |
261
|
2
|
|
|
|
|
104
|
$release_date = $release_datetime->format_cldr($self->date_format); |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# Return the results: |
265
|
5
|
|
|
|
|
612
|
chomp $text; |
266
|
|
|
|
|
|
|
|
267
|
5
|
|
|
|
|
45
|
$self->log("Version $version released $release_date"); |
268
|
5
|
|
|
|
|
2244
|
$self->zilla->chrome->logger->log($text); # No prefix |
269
|
|
|
|
|
|
|
|
270
|
5
|
|
|
|
|
1556
|
return ($release_date, $text, $release_datetime); |
271
|
|
|
|
|
|
|
} # end check_Changes |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
274
|
|
|
|
|
|
|
# Process all POD sections of a module as templates: |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub munge_file |
277
|
|
|
|
|
|
|
{ |
278
|
10
|
|
|
10
|
0
|
27
|
my ($self, $file, $dataRef, $parmsRef) = @_; |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
# Extract information from the module: |
281
|
10
|
|
|
|
|
35
|
my $pmFile = $file->name; |
282
|
10
|
|
|
|
|
563
|
my $pm_info = $self->get_module_info($file); |
283
|
|
|
|
|
|
|
|
284
|
10
|
|
|
|
|
255075
|
my $version = $pm_info->version; |
285
|
|
|
|
|
|
|
|
286
|
10
|
100
|
66
|
|
|
243
|
if (not $version and $pmFile =~ m!^lib/(.+)\.pod$!) { |
287
|
5
|
|
|
|
|
42
|
($dataRef->{module} = $1) =~ s!/!::!g; |
288
|
5
|
|
|
|
|
17
|
$version = $dataRef->{dist_version}; |
289
|
|
|
|
|
|
|
} else { |
290
|
5
|
|
|
|
|
26
|
$dataRef->{module} = $pm_info->name; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
10
|
50
|
|
|
|
97
|
die "ERROR: Can't find version in $pmFile" unless $version; |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
# level => 'debug' doesn't work here; see RT#77622: |
296
|
10
|
50
|
|
|
|
551
|
my $log_method = ($self->report_versions ? 'log' : 'log_debug'); |
297
|
10
|
|
|
|
|
90
|
$self->$log_method("$pmFile: VERSION $version"); |
298
|
|
|
|
|
|
|
|
299
|
10
|
|
|
|
|
4064
|
$dataRef->{version} = "$version"; |
300
|
10
|
|
|
|
|
36
|
$dataRef->{pm_info} = \$pm_info; |
301
|
10
|
|
|
|
|
68
|
$self->_store_pathname($dataRef, $file); |
302
|
|
|
|
|
|
|
|
303
|
10
|
|
|
|
|
41
|
$parmsRef->{FILENAME} = $pmFile; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# Process all POD sections: |
306
|
10
|
|
|
|
|
43
|
my $content = $file->content; |
307
|
|
|
|
|
|
|
|
308
|
10
|
|
|
|
|
3464
|
$self->_cur_filename($pmFile); |
309
|
10
|
|
|
|
|
561
|
$self->_cur_content(\$content); |
310
|
|
|
|
|
|
|
|
311
|
10
|
|
|
|
|
221
|
$content =~ s{( ^=(?!cut\b)\w .*? (?: \z | ^=cut\b ) )} |
312
|
|
|
|
|
|
|
{ |
313
|
15
|
|
|
|
|
4303
|
$self->_cur_offset($-[0]); |
314
|
15
|
|
|
|
|
68
|
$self->fill_in_string($1, $dataRef, $parmsRef) |
315
|
|
|
|
|
|
|
}xgems; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# And comments at BOL: |
318
|
|
|
|
|
|
|
# Text::Template breaks on strings that have the closing delimiter |
319
|
|
|
|
|
|
|
# without the opening one. Only process comments that have at |
320
|
|
|
|
|
|
|
# least one matched set of delimiters. |
321
|
10
|
|
|
|
|
7909
|
$content =~ s{( ^\# .* \{\{ .* \}\} .* )} |
322
|
|
|
|
|
|
|
{ |
323
|
15
|
|
|
|
|
8624
|
$self->_cur_offset($-[0]); |
324
|
15
|
|
|
|
|
53
|
$self->fill_in_string($1, $dataRef, $parmsRef) |
325
|
|
|
|
|
|
|
}xgem; |
326
|
|
|
|
|
|
|
|
327
|
10
|
|
|
|
|
3387
|
$file->content($content); |
328
|
10
|
|
|
|
|
3290
|
$self->_cur_content(undef); |
329
|
|
|
|
|
|
|
|
330
|
10
|
|
|
|
|
213
|
return; |
331
|
|
|
|
|
|
|
} # end munge_file |
332
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
sub build_instructions |
336
|
|
|
|
|
|
|
{ |
337
|
0
|
|
|
0
|
1
|
0
|
my ($self, $indent) = @_; |
338
|
|
|
|
|
|
|
|
339
|
0
|
0
|
|
|
|
0
|
$indent = "\t" unless defined $indent; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
# Compute build instructions: |
342
|
|
|
|
|
|
|
my ($builder) = |
343
|
|
|
|
|
|
|
sort |
344
|
0
|
|
|
|
|
0
|
grep { /^(?:Build|Makefile)\.PL$/ } |
345
|
0
|
|
|
|
|
0
|
map { $_->name } |
346
|
0
|
|
|
|
|
0
|
@{ $self->zilla->files }; |
|
0
|
|
|
|
|
0
|
|
347
|
|
|
|
|
|
|
|
348
|
0
|
0
|
|
|
|
0
|
$self->log_fatal("Unable to locate Build.PL or Makefile.PL in distribution\n". |
349
|
|
|
|
|
|
|
"TemplateCJM must come after ModuleBuild or MakeMaker") |
350
|
|
|
|
|
|
|
unless $builder; |
351
|
|
|
|
|
|
|
|
352
|
0
|
0
|
|
|
|
0
|
my $build = ($builder eq 'Build.PL' ? './Build' : 'make'); |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
0
|
join("\n", map { $indent . $_ } |
|
0
|
|
|
|
|
0
|
|
355
|
|
|
|
|
|
|
"perl $builder", |
356
|
|
|
|
|
|
|
"$build", |
357
|
|
|
|
|
|
|
"$build test", |
358
|
|
|
|
|
|
|
"$build install", |
359
|
|
|
|
|
|
|
); |
360
|
|
|
|
|
|
|
} # end build_instructions |
361
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub dependency_link |
365
|
|
|
|
|
|
|
{ |
366
|
10
|
|
|
10
|
1
|
3966
|
my ($self, $module) = @_; |
367
|
|
|
|
|
|
|
|
368
|
10
|
|
50
|
|
|
378
|
my $meta = $self->zilla->distmeta->{prereqs}{runtime} || {}; |
369
|
10
|
|
|
|
|
424
|
my $ver; |
370
|
|
|
|
|
|
|
|
371
|
10
|
|
|
|
|
21
|
for my $key (qw(requires recommends)) { |
372
|
10
|
50
|
|
|
|
46
|
last if defined($ver = $meta->{$key}{$module}); |
373
|
|
|
|
|
|
|
} # end for each $key |
374
|
|
|
|
|
|
|
|
375
|
10
|
50
|
|
|
|
24
|
$self->log("WARNING: Can't find $module in prerequisites") |
376
|
|
|
|
|
|
|
unless defined $ver; |
377
|
|
|
|
|
|
|
|
378
|
10
|
100
|
|
|
|
22
|
if ($ver) { "L<$module> ($ver or later)" } |
|
5
|
|
|
|
|
54
|
|
379
|
5
|
|
|
|
|
54
|
else { "L<$module>" } |
380
|
|
|
|
|
|
|
} # end dependency_link |
381
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
sub dependency_list |
385
|
|
|
|
|
|
|
{ |
386
|
5
|
|
|
5
|
1
|
13543
|
my ($self) = @_; |
387
|
|
|
|
|
|
|
|
388
|
5
|
|
|
|
|
10
|
my %requires = %{ $self->zilla->distmeta->{prereqs}{runtime}{requires} }; |
|
5
|
|
|
|
|
199
|
|
389
|
|
|
|
|
|
|
|
390
|
5
|
|
|
|
|
249
|
my @modules = sort grep { $_ ne 'perl' } keys %requires; |
|
20
|
|
|
|
|
66
|
|
391
|
|
|
|
|
|
|
|
392
|
5
|
50
|
|
|
|
25
|
if ($requires{perl}) { |
393
|
5
|
|
|
|
|
13
|
unshift @modules, 'perl'; |
394
|
|
|
|
|
|
|
# Standardize Perl version number: |
395
|
5
|
|
|
|
|
43
|
require version; version->VERSION(0.77); |
|
5
|
|
|
|
|
170
|
|
396
|
5
|
|
|
|
|
36
|
(my $v = $requires{perl}) =~ s/_//g; |
397
|
5
|
|
|
|
|
31
|
$v = version->parse($v); |
398
|
5
|
50
|
|
|
|
127
|
$requires{perl} = $v->normal if $v >= 5.006; |
399
|
|
|
|
|
|
|
} # end if minimum Perl version |
400
|
|
|
|
|
|
|
|
401
|
5
|
50
|
|
|
|
24
|
return 'None.' unless @modules; |
402
|
|
|
|
|
|
|
|
403
|
5
|
|
|
|
|
51
|
s/^v// for values %requires; |
404
|
|
|
|
|
|
|
|
405
|
5
|
|
|
|
|
13
|
my $width = List::Util::max(6, map { length $_ } @modules) + 1; |
|
20
|
|
|
|
|
57
|
|
406
|
|
|
|
|
|
|
|
407
|
5
|
|
|
|
|
27
|
my $text = sprintf(" %-${width}s %s\n ", 'Package', 'Minimum Version'); |
408
|
5
|
|
|
|
|
19
|
$text .= ('-' x $width) . " ---------------\n"; |
409
|
|
|
|
|
|
|
|
410
|
5
|
|
|
|
|
8
|
++$width; |
411
|
|
|
|
|
|
|
|
412
|
5
|
|
|
|
|
10
|
foreach my $req (@modules) { |
413
|
20
|
|
100
|
|
|
133
|
$text .= sprintf(" %-${width}s %s\n", $req, $requires{$req} || ''); |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
5
|
|
|
|
|
54
|
$text =~ s/\s+\z//; # Remove final newline |
417
|
|
|
|
|
|
|
|
418
|
5
|
|
|
|
|
56
|
$text; |
419
|
|
|
|
|
|
|
} # end dependency_list |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
422
|
|
|
|
|
|
|
# Report a template error and die: |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
has _cur_filename => ( |
425
|
|
|
|
|
|
|
is => 'rw', |
426
|
|
|
|
|
|
|
isa => 'Str', |
427
|
|
|
|
|
|
|
); |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
# This is a reference to the text we're processing templates in |
430
|
|
|
|
|
|
|
has _cur_content => ( |
431
|
|
|
|
|
|
|
is => 'rw', |
432
|
|
|
|
|
|
|
isa => 'Maybe[ScalarRef]', |
433
|
|
|
|
|
|
|
); |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
# This is the position in _cur_content where this template began |
436
|
|
|
|
|
|
|
has _cur_offset => ( |
437
|
|
|
|
|
|
|
is => 'rw', |
438
|
|
|
|
|
|
|
isa => 'Int', |
439
|
|
|
|
|
|
|
); |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
sub template_error |
442
|
|
|
|
|
|
|
{ |
443
|
0
|
|
|
0
|
0
|
|
my ($self, %e) = @_; |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
# Calculate the line number where the template started: |
446
|
0
|
|
|
|
|
|
my $offset = $self->_cur_offset; |
447
|
0
|
0
|
|
|
|
|
if ($offset) { |
448
|
0
|
|
|
|
|
|
$offset = substr(${ $self->_cur_content }, 0, $offset) =~ tr/\n//; |
|
0
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
# Put the filename & line number into the error message: |
452
|
0
|
|
|
|
|
|
my $err = $e{error}; |
453
|
0
|
|
|
|
|
|
my $fn = $self->_cur_filename; |
454
|
0
|
|
|
|
|
|
$err =~ s/ at template line (\d+)/ " at $fn line " . ($1 + $offset) /eg; |
|
0
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
|
456
|
0
|
|
|
|
|
|
die $err; |
457
|
|
|
|
|
|
|
} # end template_error |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
460
|
2
|
|
|
2
|
|
13
|
no Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
461
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
462
|
|
|
|
|
|
|
1; |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
__END__ |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head1 NAME |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Dist::Zilla::Plugin::TemplateCJM - Process templates, including version numbers & changes |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=head1 VERSION |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
This document describes version 5.000 of |
473
|
|
|
|
|
|
|
Dist::Zilla::Plugin::TemplateCJM, released December 5, 2015. |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=head1 SYNOPSIS |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
In your F<dist.ini>: |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
[TemplateCJM] |
480
|
|
|
|
|
|
|
changelog = Changes ; this is the default |
481
|
|
|
|
|
|
|
changes = 1 ; this is the default |
482
|
|
|
|
|
|
|
file = README ; this is the default |
483
|
|
|
|
|
|
|
report_versions = 1 ; this is the default |
484
|
|
|
|
|
|
|
date_format = ; this is the default |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
=head1 DESCRIPTION |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
This plugin is the successor to L<Module::Build::DistVersion>. |
489
|
|
|
|
|
|
|
It performs the following actions: |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=over |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=item 1. |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
It opens the F<Changes> file, and finds the first version listed. The |
496
|
|
|
|
|
|
|
line must begin with the version number, and everything after the |
497
|
|
|
|
|
|
|
version number is considered to be the release date. The version |
498
|
|
|
|
|
|
|
number from Changes must match Dist::Zilla's idea of the |
499
|
|
|
|
|
|
|
distribution version, or the process stops here with an error. |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=item 2. |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
It processes each template file with Text::Template. Template files |
504
|
|
|
|
|
|
|
are specified with the L<< C<file> attribute|/"file" >>. Any number of |
505
|
|
|
|
|
|
|
templates may be present. |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
Each template may use the following variables: |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=over |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=item C<$changes> |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
The changes in the current release. This is a string containing all |
514
|
|
|
|
|
|
|
lines in F<Changes> following the version/release date line up to (but |
515
|
|
|
|
|
|
|
not including) the next line that begins with a non-whitespace |
516
|
|
|
|
|
|
|
character (or end-of-file). The string does B<not> end with a newline |
517
|
|
|
|
|
|
|
(since version 0.08). |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
You can include the changes from more than one release by setting the |
520
|
|
|
|
|
|
|
L<< C<changes> attribute/"changes" >>. This is useful when you make a |
521
|
|
|
|
|
|
|
major release immediately followed by a bugfix release. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=item C<$date> |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
The release date taken from F<Changes> and reformatted using L</date_format>. |
526
|
|
|
|
|
|
|
If C<date_format> is the empty string, or if the release date cannot |
527
|
|
|
|
|
|
|
be parsed as a date, this is the date exactly as it appears in |
528
|
|
|
|
|
|
|
F<Changes>. |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=item C<$datetime> |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
The release date taken from F<Changes> as a L<DateTime> object, or |
533
|
|
|
|
|
|
|
C<undef> if the release date could not be parsed as a date. |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=item C<$dist> |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
The name of the distribution. |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=item C<$filename> |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
The filename of the file being processed, with any directory names omitted. |
542
|
|
|
|
|
|
|
See also C<$pathname>. |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=item C<%meta> |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
The hash of metadata that will be stored in F<META.yml>. |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=item C<$pathname> |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
The pathname of the file being processed, relative to the distribution |
551
|
|
|
|
|
|
|
root in Unix format (forward slashes). See also C<$filename>. |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=item C<$t> |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
The TemplateCJM object that is processing the template. |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=item C<$version> |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
The distribution's version number. (Also available as C<$dist_version>.) |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=item C<$zilla> |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
The Dist::Zilla object that is creating the distribution. |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=back |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=item 3. |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
For each module to be installed, it processes each POD section and |
570
|
|
|
|
|
|
|
each comment that starts at the beginning of a line through |
571
|
|
|
|
|
|
|
Text::Template. |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
Each section may use the same variables as step 2, plus the following: |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=over |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=item C<$module> |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
The name of the module being processed (i.e., its package). |
580
|
|
|
|
|
|
|
In the case of a pure-POD file without a C<package> declaration, |
581
|
|
|
|
|
|
|
this is derived from its filename (which must match the regex |
582
|
|
|
|
|
|
|
C<^lib/(.+)\.pod$>). |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=item C<$pm_info> |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
A Module::Metadata object containing information about the |
587
|
|
|
|
|
|
|
module. (Note that the filename in C<$pm_info> will not be correct.) |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=item C<$version> |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
The module's version number. This may be different than the |
592
|
|
|
|
|
|
|
distribution's version, which is available as C<$dist_version>. |
593
|
|
|
|
|
|
|
In the case of a pure-POD file without a C<$VERSION> declaration, |
594
|
|
|
|
|
|
|
this will be the same as C<$dist_version>. |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=back |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=back |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
It also peforms a L<BeforeRelease|Dist::Zilla::Role::BeforeRelease> |
601
|
|
|
|
|
|
|
check to ensure that the release date in the changelog is a valid date. |
602
|
|
|
|
|
|
|
(I set the date to NOT until I'm ready to release.) |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
=for Pod::Coverage |
606
|
|
|
|
|
|
|
before_release |
607
|
|
|
|
|
|
|
check_Changes |
608
|
|
|
|
|
|
|
munge_file |
609
|
|
|
|
|
|
|
mvp_multivalue_args |
610
|
|
|
|
|
|
|
setup_installer |
611
|
|
|
|
|
|
|
template_error |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=head2 changelog |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
This is the name of the F<Changes> file. It defaults to F<Changes>. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=head2 changelog_re |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
This is the regex used to extract the version and release date from |
623
|
|
|
|
|
|
|
the F<Changes> file. It defaults to C<(\d[\d._]*)\s+(.+)> |
624
|
|
|
|
|
|
|
(i.e. version number at beginning of the line, followed by whitespace, |
625
|
|
|
|
|
|
|
and everything after that is the release date). It it automatically |
626
|
|
|
|
|
|
|
anchored at the beginning of the line. Note: your version lines |
627
|
|
|
|
|
|
|
I<must not> begin with whitespace. All other lines I<must> begin with |
628
|
|
|
|
|
|
|
whitespace. |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=head2 changes |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
This is the number of releases to include in the C<$changes> variable |
634
|
|
|
|
|
|
|
passed to templates. It defaults to 1 (meaning only changes in the |
635
|
|
|
|
|
|
|
current release). This is useful when you make a major release |
636
|
|
|
|
|
|
|
immediately followed by a bugfix release. |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
=head2 date_format |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
This is the DateTime CLDR format to use for the C<$date> variable in |
642
|
|
|
|
|
|
|
templates. The default value is the empty string, which means to use |
643
|
|
|
|
|
|
|
the date exactly as it appeared in the F<Changes> file. |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=head2 file |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
This is the name of a file to process with Text::Template in step 2. |
649
|
|
|
|
|
|
|
The C<file> attribute may be listed any number of times. If you don't |
650
|
|
|
|
|
|
|
list any C<file>s, it defaults to F<README>. If you do specify any |
651
|
|
|
|
|
|
|
C<file>s, then F<README> is not processed unless explicitly specified. |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=head2 finder |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
This FileFinder provides the list of files that are processed in step |
657
|
|
|
|
|
|
|
3. The default is C<:InstallModules>. The C<finder> attribute may be |
658
|
|
|
|
|
|
|
listed any number of times. |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
=head2 report_versions |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
If true (the default), report the version of each module processed. |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=head1 METHODS |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
=head2 build_instructions |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
$t->build_instructions( [$prefix] ) |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
A template can use this method to add build instructions for the |
672
|
|
|
|
|
|
|
distribution (normally used in README). C<$prefix> is prepended to |
673
|
|
|
|
|
|
|
each line, and defaults to a single TAB. |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
It returns either |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
perl Build.PL |
678
|
|
|
|
|
|
|
./Build |
679
|
|
|
|
|
|
|
./Build test |
680
|
|
|
|
|
|
|
./Build install |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
or |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
perl Makefile.PL |
685
|
|
|
|
|
|
|
make |
686
|
|
|
|
|
|
|
make test |
687
|
|
|
|
|
|
|
make install |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
depending on whether your distribution includes a Build.PL. The |
690
|
|
|
|
|
|
|
string will NOT end with a newline. |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
It throws an error if neither Build.PL nor Makefile.PL is found. |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
=head2 dependency_link |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
$t->dependency_link('Foo::Bar') |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
A template can use this method to add a link to the documentation of a |
700
|
|
|
|
|
|
|
required module. It returns either |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
L<Foo::Bar> (VERSION or later) |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
or |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
L<Foo::Bar> |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
depending on whether VERSION is non-zero. (It determines VERSION by |
709
|
|
|
|
|
|
|
checking C<requires> and C<recommends> in your prerequisites.) |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
=head2 dependency_list |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
$t->dependency_list |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
A template can use this method to add a list of required modules. |
717
|
|
|
|
|
|
|
It returns a string like: |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
Package Minimum Version |
720
|
|
|
|
|
|
|
---------------------- --------------- |
721
|
|
|
|
|
|
|
perl 5.8.0 |
722
|
|
|
|
|
|
|
List::Util |
723
|
|
|
|
|
|
|
Moose 0.90 |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
If C<perl> is one of the dependencies, it is listed first. Also, its |
726
|
|
|
|
|
|
|
version (if >= 5.6.0) will be normalized into double-decimal form, |
727
|
|
|
|
|
|
|
even if the prerequisites list it as floating point. |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
All other dependencies are listed in ASCIIbetical order. The string |
730
|
|
|
|
|
|
|
will NOT end with a newline. |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
If there are no dependencies, the string C<None.> will be returned. |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
TemplateCJM requires L<Dist::Zilla> (5 or later) and |
737
|
|
|
|
|
|
|
L<Text::Template>. I also recommend applying F<Template_strict.patch> |
738
|
|
|
|
|
|
|
to Text::Template. This will add support for the STRICT option, which |
739
|
|
|
|
|
|
|
will help catch errors in your templates. |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
None reported. |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
No bugs have been reported. |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
=head1 AUTHOR |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
Christopher J. Madsen S<C<< <perl AT cjmweb.net> >>> |
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
Please report any bugs or feature requests |
754
|
|
|
|
|
|
|
to S<C<< <bug-Dist-Zilla-Plugin-TemplateCJM AT rt.cpan.org> >>> |
755
|
|
|
|
|
|
|
or through the web interface at |
756
|
|
|
|
|
|
|
L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugin-TemplateCJM >>. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
You can follow or contribute to Dist-Zilla-Plugin-TemplateCJM's development at |
759
|
|
|
|
|
|
|
L<< https://github.com/madsen/dist-zilla-plugin-templatecjm >>. |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Christopher J. Madsen. |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
766
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
771
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
772
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
773
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
774
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
775
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
776
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
777
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
778
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
781
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
782
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE |
783
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
784
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
785
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
786
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
787
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
788
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
789
|
|
|
|
|
|
|
SUCH DAMAGES. |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
=cut |