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