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