line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::Plicease::MakeMaker 2.41 { |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2569803
|
use 5.014; |
|
2
|
|
|
|
|
7
|
|
4
|
2
|
|
|
2
|
|
10
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
5
|
2
|
|
|
2
|
|
10968
|
use namespace::autoclean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
6
|
2
|
|
|
2
|
|
1690
|
use Perl::Tidy (); |
|
2
|
|
|
|
|
397462
|
|
|
2
|
|
|
|
|
67
|
|
7
|
2
|
|
|
2
|
|
463
|
use Dist::Zilla::Plugin::Author::Plicease (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
39
|
|
8
|
2
|
|
|
2
|
|
11
|
use List::Util qw( first ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2962
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: munge the AUTHOR section |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
extends 'Dist::Zilla::Plugin::MakeMaker'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
around write_makefile_args => sub { |
18
|
|
|
|
|
|
|
my($orig, $self, @args) = @_; |
19
|
|
|
|
|
|
|
my $h = $self->$orig(@args); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# to prevent any non .pm/.pod files from being installed in lib |
22
|
|
|
|
|
|
|
# because shit like this is stuff we ought to have to customize. |
23
|
|
|
|
|
|
|
my %PM = map {; "lib/$_" => "\$(INST_LIB)/$_" } map { s/^lib\///; $_ } grep /^lib\/.*\.p(od|m)$/, map { $_->name } @{ $self->zilla->files }; |
24
|
|
|
|
|
|
|
$h->{PM} = \%PM; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$h; |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
around setup_installer => sub { |
30
|
|
|
|
|
|
|
my($orig, $self, @args) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$self->$orig(@args); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $file = first { $_->name eq 'Makefile.PL' } @{ $self->zilla->files }; |
35
|
|
|
|
|
|
|
my $mod = first { $_->name eq 'inc/mymm.pl' } @{ $self->zilla->files }; |
36
|
|
|
|
|
|
|
my $config = first { $_->name eq 'inc/mymm-config.pl' } @{ $self->zilla->files }; |
37
|
|
|
|
|
|
|
my $build = first { $_->name eq 'inc/mymm-build.pl' } @{ $self->zilla->files }; |
38
|
|
|
|
|
|
|
my $test = first { $_->name eq 'inc/mymm-test.pl' } @{ $self->zilla->files }; |
39
|
|
|
|
|
|
|
my $clean = first { $_->name eq 'inc/mymm-clean.pl' } @{ $self->zilla->files }; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my @content = do { |
42
|
|
|
|
|
|
|
my $in = $file->content; |
43
|
|
|
|
|
|
|
my $out = ''; |
44
|
|
|
|
|
|
|
my $err = ''; |
45
|
|
|
|
|
|
|
local @ARGV = (); |
46
|
|
|
|
|
|
|
my $error = Perl::Tidy::perltidy( |
47
|
|
|
|
|
|
|
source => \$in, |
48
|
|
|
|
|
|
|
destination => \$out, |
49
|
|
|
|
|
|
|
stderr => \$err, |
50
|
|
|
|
|
|
|
perltidyrc => Dist::Zilla::Plugin::Author::Plicease->dist_dir->child('perltidyrc')->stringify, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
$self->log("perltidy: $_") for split /\n/, $err; |
53
|
|
|
|
|
|
|
$self->log_fatal("perltidy failed!") if $error; |
54
|
|
|
|
|
|
|
split /\n/, $out; |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# pet-peve1: remove blank lines between use |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
my $i = 0; |
60
|
|
|
|
|
|
|
while($i<$#content) |
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
if($content[$i] =~ /^(use|#)/) |
63
|
|
|
|
|
|
|
{ $i++ } |
64
|
|
|
|
|
|
|
elsif($content[$i] =~ /^\s*$/) |
65
|
|
|
|
|
|
|
{ @content = @content[0..($i-1),($i+1)..$#content] } |
66
|
|
|
|
|
|
|
else |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
my @extra = (''); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if($mod) |
71
|
|
|
|
|
|
|
{ |
72
|
|
|
|
|
|
|
unshift @extra, 'require "./inc/mymm.pl";'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
@content = ( |
76
|
|
|
|
|
|
|
@content[0..($i-1)], |
77
|
|
|
|
|
|
|
@extra, |
78
|
|
|
|
|
|
|
@content[($i)..$#content] |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
last; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# pet-peve2: squeeze multiple blank lines |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
my @new; |
88
|
|
|
|
|
|
|
my $last_empty = 0; |
89
|
|
|
|
|
|
|
foreach my $line (@content) |
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
if($line =~ /^\s*$/) |
92
|
|
|
|
|
|
|
{ |
93
|
|
|
|
|
|
|
if($last_empty) |
94
|
|
|
|
|
|
|
{ next } |
95
|
|
|
|
|
|
|
else |
96
|
|
|
|
|
|
|
{ |
97
|
|
|
|
|
|
|
$last_empty = 1; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
else |
101
|
|
|
|
|
|
|
{ |
102
|
|
|
|
|
|
|
$last_empty = 0; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
push @new, $line; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
@content = @new; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
if($mod || $test) |
111
|
|
|
|
|
|
|
{ |
112
|
|
|
|
|
|
|
my $last = pop @content; |
113
|
|
|
|
|
|
|
if($last =~ /^WriteMakefile\(/) |
114
|
|
|
|
|
|
|
{ |
115
|
|
|
|
|
|
|
my @new; |
116
|
|
|
|
|
|
|
while(defined $content[0] && $content[0] !~ /\%FallbackPrereqs/) |
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
my $line = shift @content; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
if($test) |
121
|
|
|
|
|
|
|
{ |
122
|
|
|
|
|
|
|
# TODO: not exactly sure when the test order was fixed in EUMM. |
123
|
|
|
|
|
|
|
# research and correct. |
124
|
|
|
|
|
|
|
$line =~ s/use ExtUtils::MakeMaker;/use ExtUtils::MakeMaker 7.1001;/; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
else |
127
|
|
|
|
|
|
|
{ |
128
|
|
|
|
|
|
|
$line =~ s/use ExtUtils::MakeMaker;/use ExtUtils::MakeMaker 6.64;/; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
push @new, $line; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
0
|
|
|
eval $mod->content; |
135
|
|
|
|
|
|
|
$self->log_fatal("unable to eval inc/mymm.pl: $@") if $@; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
if(mymm->can('myWriteMakefile')) |
138
|
|
|
|
|
|
|
{ |
139
|
|
|
|
|
|
|
$last = "mymm::my$last"; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
@content = ( @new, $last ); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
else |
145
|
|
|
|
|
|
|
{ |
146
|
|
|
|
|
|
|
$self->log_fatal("unable to find WriteMakefile in Makefile.PL"); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
if($config || $build || $test || $clean) |
152
|
|
|
|
|
|
|
{ |
153
|
|
|
|
|
|
|
push @content, "{ package MY;"; |
154
|
|
|
|
|
|
|
push @content, " sub postamble {"; |
155
|
|
|
|
|
|
|
push @content, " my \$postamble = '';"; |
156
|
|
|
|
|
|
|
push @content, ''; |
157
|
|
|
|
|
|
|
if($config) |
158
|
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
|
push @content, " \$postamble .="; |
160
|
|
|
|
|
|
|
push @content, " \"config :: _mm/config\\n\" ."; |
161
|
|
|
|
|
|
|
push @content, " \"mymm-config _mm/config:\\n\" ."; |
162
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(FULLPERL) inc/mymm-config.pl\\n\" ."; |
163
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(NOECHO)\\\$(MKPATH) _mm\\n\" ."; |
164
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(NOECHO)\\\$(TOUCH) _mm/config\\n\\n\";"; |
165
|
|
|
|
|
|
|
push @content, ''; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
if($build) |
168
|
|
|
|
|
|
|
{ |
169
|
|
|
|
|
|
|
push @content, " \$postamble .="; |
170
|
|
|
|
|
|
|
push @content, " \"pure_all :: mymm-build\\n\" ."; |
171
|
|
|
|
|
|
|
push @content, " \"mymm-build :@{[ $config ? ' _mm/config' : '' ]}\\n\" ."; |
172
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(FULLPERL) inc/mymm-build.pl\\n\\n\";"; |
173
|
|
|
|
|
|
|
push @content, ''; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
if($test) |
176
|
|
|
|
|
|
|
{ |
177
|
|
|
|
|
|
|
push @content, " \$postamble .="; |
178
|
|
|
|
|
|
|
push @content, " \"subdirs-test_dynamic subdirs-test_static subdirs-test :: mymm-test\\n\" ."; |
179
|
|
|
|
|
|
|
push @content, " \"mymm-test :\\n\" ."; |
180
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(FULLPERL) inc/mymm-test.pl\\n\\n\";"; |
181
|
|
|
|
|
|
|
push @content, ''; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
if($clean) |
184
|
|
|
|
|
|
|
{ |
185
|
|
|
|
|
|
|
push @content, " \$postamble .="; |
186
|
|
|
|
|
|
|
push @content, " \"clean :: mymm-clean\\n\" ."; |
187
|
|
|
|
|
|
|
push @content, " \"mymm-clean :\\n\" ."; |
188
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(FULLPERL) inc/mymm-clean.pl\\n\" ."; |
189
|
|
|
|
|
|
|
push @content, " \"\\t\\\$(RM_RF) _mm\\n\\n\";"; |
190
|
|
|
|
|
|
|
push @content, ''; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
push @content, " \$postamble;"; |
193
|
|
|
|
|
|
|
push @content, " }"; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
push @content, " sub special_targets {"; |
196
|
|
|
|
|
|
|
push @content, " my(\$self, \@therest) = \@_;"; |
197
|
|
|
|
|
|
|
push @content, " my \$st = \$self->SUPER::special_targets(\@therest);"; |
198
|
|
|
|
|
|
|
push @content, " \$st .= \"\\n.PHONY:"; |
199
|
|
|
|
|
|
|
$content[-1] .= " mymm-config" if $config; |
200
|
|
|
|
|
|
|
$content[-1] .= " mymm-build" if $build; |
201
|
|
|
|
|
|
|
$content[-1] .= " mymm-test" if $test; |
202
|
|
|
|
|
|
|
$content[-1] .= " mymm-clean" if $clean; |
203
|
|
|
|
|
|
|
$content[-1] .= "\\n\";"; |
204
|
|
|
|
|
|
|
push @content, " \$st;"; |
205
|
|
|
|
|
|
|
push @content, " }"; |
206
|
|
|
|
|
|
|
push @content, "}"; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
$file->content(join "\n", @content); |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
return; |
212
|
|
|
|
|
|
|
}; |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
around register_prereqs => sub { |
215
|
|
|
|
|
|
|
my($orig, $self, @args) = @_; |
216
|
|
|
|
|
|
|
my $h = $self->$orig(@args); |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
my $mod = first { $_->name eq 'inc/mymm.pl' } @{ $self->zilla->files }; |
219
|
|
|
|
|
|
|
if($mod) |
220
|
|
|
|
|
|
|
{ |
221
|
|
|
|
|
|
|
$self->zilla->register_prereqs( |
222
|
|
|
|
|
|
|
{ phase => 'configure' }, |
223
|
|
|
|
|
|
|
'ExtUtils::MakeMaker' => '6.64' |
224
|
|
|
|
|
|
|
); |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $test = first { $_->name eq 'inc/mymm-test.pl' } @{ $self->zilla->files }; |
228
|
|
|
|
|
|
|
if($test) |
229
|
|
|
|
|
|
|
{ |
230
|
|
|
|
|
|
|
$self->zilla->register_prereqs( |
231
|
|
|
|
|
|
|
{ phase => 'configure' }, |
232
|
|
|
|
|
|
|
'ExtUtils::MakeMaker' => '7.1001' |
233
|
|
|
|
|
|
|
); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
return; |
237
|
|
|
|
|
|
|
}; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub metadata |
240
|
|
|
|
|
|
|
{ |
241
|
2
|
|
|
2
|
0
|
5685
|
my($self) = @_; |
242
|
|
|
|
|
|
|
|
243
|
2
|
|
|
|
|
4
|
my %meta; |
244
|
|
|
|
|
|
|
|
245
|
2
|
|
|
7
|
|
11
|
my $mod = first { $_->name eq 'inc/mymm.pl' } @{ $self->zilla->files }; |
|
7
|
|
|
|
|
253
|
|
|
2
|
|
|
|
|
63
|
|
246
|
|
|
|
|
|
|
|
247
|
2
|
100
|
|
|
|
80
|
$meta{dynamic_config} = 1 if $mod; |
248
|
|
|
|
|
|
|
|
249
|
2
|
|
|
|
|
9
|
\%meta; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
1; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
__END__ |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=pod |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=encoding UTF-8 |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head1 NAME |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::Plicease::MakeMaker - munge the AUTHOR section |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head1 VERSION |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
version 2.41 |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head1 SYNOPSIS |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
[Author::Plicease::MakeMaker] |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head1 DESCRIPTION |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
My personal customization of the L<Dist::Zilla::Plugin::MakeMaker>. You are unlikely to |
278
|
|
|
|
|
|
|
need or want to use this. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head1 SEE ALSO |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::Plicease> |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head1 AUTHOR |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Graham Ollis. |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
293
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |