line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
21
|
|
|
21
|
|
4613414
|
use 5.014; # because we use the 'non-destructive substitution' feature (s///r) |
|
21
|
|
|
|
|
115
|
|
2
|
21
|
|
|
21
|
|
142
|
use strict; |
|
21
|
|
|
|
|
66
|
|
|
21
|
|
|
|
|
563
|
|
3
|
21
|
|
|
21
|
|
129
|
use warnings; |
|
21
|
|
|
|
|
55
|
|
|
21
|
|
|
|
|
1594
|
|
4
|
|
|
|
|
|
|
package Banal::Dist::Zilla::Role::PluginBundle::Easier; |
5
|
|
|
|
|
|
|
# vim: set ts=2 sts=2 sw=2 tw=115 et : |
6
|
|
|
|
|
|
|
# ABSTRACT: The base class for TABULO's plugin bundle for distributions built by TABULO |
7
|
|
|
|
|
|
|
# BASED_ON: Dist::Zilla::PluginBundle::Author::ETHER |
8
|
|
|
|
|
|
|
# KEYWORDS: author bundle distribution tool |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.198'; |
11
|
|
|
|
|
|
|
# AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
7223
|
use Moose::Role; |
|
21
|
|
|
|
|
556100
|
|
|
21
|
|
|
|
|
125
|
|
14
|
|
|
|
|
|
|
requires qw( _extra_args payload ); |
15
|
|
|
|
|
|
|
with |
16
|
|
|
|
|
|
|
'Dist::Zilla::Role::PluginBundle::Easy', |
17
|
|
|
|
|
|
|
'Dist::Zilla::Role::PluginBundle::PluginRemover' => { -version => '0.103' }, |
18
|
|
|
|
|
|
|
'Dist::Zilla::Role::PluginBundle::Config::Slicer'; |
19
|
|
|
|
|
|
|
|
20
|
21
|
|
|
21
|
|
121991
|
use Data::Printer; |
|
21
|
|
|
|
|
32155
|
|
|
21
|
|
|
|
|
247
|
|
21
|
21
|
|
|
21
|
|
11604
|
use Object::Tiny; |
|
21
|
|
|
|
|
6754
|
|
|
21
|
|
|
|
|
152
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#use Dist::Zilla::PluginBundle::Author::TABULO::Config qw(configuration detect_settings); |
24
|
21
|
|
|
21
|
|
11070
|
use Banal::Dist::Util; |
|
21
|
|
|
|
|
54777
|
|
|
21
|
|
|
|
|
214
|
|
25
|
21
|
|
|
21
|
|
3292
|
use Dist::Zilla::Util; |
|
21
|
|
|
|
|
2711
|
|
|
21
|
|
|
|
|
672
|
|
26
|
|
|
|
|
|
|
#use Types::Standard; |
27
|
|
|
|
|
|
|
#use Type::Utils qw(enum subtype where class_type); |
28
|
21
|
|
|
21
|
|
183
|
use Moose::Util::TypeConstraints qw(enum subtype where class_type); |
|
21
|
|
|
|
|
57
|
|
|
21
|
|
|
|
|
192
|
|
29
|
21
|
|
|
21
|
|
16377
|
use Scalar::Util qw(refaddr); |
|
21
|
|
|
|
|
62
|
|
|
21
|
|
|
|
|
1439
|
|
30
|
21
|
|
|
21
|
|
156
|
use List::Util 1.45 qw(first all any none pairs uniq); |
|
21
|
|
|
|
|
424
|
|
|
21
|
|
|
|
|
2044
|
|
31
|
21
|
|
|
21
|
|
721
|
use List::MoreUtils qw(arrayify); |
|
21
|
|
|
|
|
8530
|
|
|
21
|
|
|
|
|
223
|
|
32
|
21
|
|
|
21
|
|
23403
|
use Module::Runtime qw(require_module use_module); |
|
21
|
|
|
|
|
66
|
|
|
21
|
|
|
|
|
181
|
|
33
|
21
|
|
|
21
|
|
1656
|
use Devel::CheckBin 'can_run'; |
|
21
|
|
|
|
|
96056
|
|
|
21
|
|
|
|
|
979
|
|
34
|
21
|
|
|
21
|
|
692
|
use CPAN::Meta::Requirements; |
|
21
|
|
|
|
|
4527
|
|
|
21
|
|
|
|
|
445
|
|
35
|
21
|
|
|
21
|
|
171
|
use Config; |
|
21
|
|
|
|
|
54
|
|
|
21
|
|
|
|
|
2136
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# TABULO : a custom 'has' to save some typing and lines ... :-) |
38
|
|
|
|
|
|
|
# The '*' in the prototype allows bareword attribute names. |
39
|
84
|
|
|
84
|
0
|
38588
|
sub haz (*@) { my $name=shift; has ( $name => ( is => 'ro', init_arg => undef, lazy => 1, @_)); } |
|
84
|
|
|
|
|
401
|
|
40
|
|
|
|
|
|
|
|
41
|
21
|
|
|
21
|
|
163
|
use namespace::autoclean; |
|
21
|
|
|
|
|
53
|
|
|
21
|
|
|
|
|
120
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# haz zilla => ( # DOES NOT WORK because we have no way of getting at it!!! |
44
|
|
|
|
|
|
|
# is => 'rw', |
45
|
|
|
|
|
|
|
# isa => class_type('Dist::Zilla'), |
46
|
|
|
|
|
|
|
# weak_ref => 1, |
47
|
|
|
|
|
|
|
# lazy => 0, # Would be set to '1' if we had a 'default' |
48
|
|
|
|
|
|
|
# #default => sub { Object::Tiny->new() }, # TODO: FIXME |
49
|
|
|
|
|
|
|
# ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
haz _detected_bash => ( |
53
|
|
|
|
|
|
|
isa => 'Bool', |
54
|
|
|
|
|
|
|
default => sub { !!can_run('bash') }, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
haz _detected_xs => ( |
58
|
|
|
|
|
|
|
isa => 'Bool', |
59
|
|
|
|
|
|
|
default => sub { glob('*.xs') ? 1 : 0 }, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# note this is applied to the plugin list in Dist::Zilla::Role::PluginBundle::PluginRemover, |
63
|
|
|
|
|
|
|
# but we also need to use it here to be sure we are not adding configs that are only needed |
64
|
|
|
|
|
|
|
# by plugins that will be subsequently removed. |
65
|
|
|
|
|
|
|
haz _removed_plugin => ( |
66
|
|
|
|
|
|
|
isa => 'HashRef[Str]', |
67
|
|
|
|
|
|
|
init_arg => undef, |
68
|
|
|
|
|
|
|
lazy => 1, |
69
|
|
|
|
|
|
|
default => sub { |
70
|
|
|
|
|
|
|
my $self = shift; |
71
|
|
|
|
|
|
|
my $remove = $self->payload->{ $self->plugin_remover_attribute } // []; |
72
|
|
|
|
|
|
|
my %removed; @removed{@$remove} = (!!1) x @$remove; |
73
|
|
|
|
|
|
|
\%removed; |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
traits => ['Hash'], |
76
|
|
|
|
|
|
|
handles => { _plugin_removed => 'exists', _removed_plugins => 'keys'}, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# this attribute and its supporting code is a candidate to be extracted out into its own role, |
81
|
|
|
|
|
|
|
# for re-use in other bundles |
82
|
|
|
|
|
|
|
haz _develop_suggests => ( |
83
|
|
|
|
|
|
|
isa => class_type('CPAN::Meta::Requirements'), |
84
|
|
|
|
|
|
|
lazy => 1, |
85
|
|
|
|
|
|
|
default => sub { CPAN::Meta::Requirements->new }, |
86
|
|
|
|
|
|
|
handles => { |
87
|
|
|
|
|
|
|
_add_minimum_develop_suggests => 'add_minimum', |
88
|
|
|
|
|
|
|
_develop_suggests_as_string_hash => 'as_string_hash', |
89
|
|
|
|
|
|
|
}, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
####################################### |
94
|
|
|
|
|
|
|
sub bundle_config { # OVERRIDES 'Dist::Zilla::Role::PluginBundle::Easy' |
95
|
|
|
|
|
|
|
####################################### |
96
|
39
|
|
|
39
|
0
|
482395
|
my ($class, $section) = @_; |
97
|
|
|
|
|
|
|
|
98
|
39
|
|
|
|
|
1773
|
my $self = $class->new($section); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# TAU: Save zilla in an attribute. This is the only difference with the overriden version. |
101
|
|
|
|
|
|
|
# TODO : Remove, since it does NOT work. |
102
|
|
|
|
|
|
|
# This is because, unlike elsewhere, here '$section 'is just a plain unblessed hash which does NOT contain any 'sequence'. |
103
|
|
|
|
|
|
|
# $self->zilla($section->sequence->assembler->zilla); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# say STDERR "bundle_config called with SECTION : " . np $section; |
106
|
|
|
|
|
|
|
|
107
|
39
|
|
|
|
|
991
|
$self->configure; |
108
|
|
|
|
|
|
|
|
109
|
39
|
|
|
|
|
11072
|
return @{ $self->plugins }; |
|
39
|
|
|
|
|
1511
|
|
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
####################################### |
115
|
|
|
|
|
|
|
around add_plugins => sub { |
116
|
|
|
|
|
|
|
####################################### |
117
|
|
|
|
|
|
|
my ($orig, $self, @plugins) = @_; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
@plugins = grep { |
120
|
|
|
|
|
|
|
my $plugin = $_; |
121
|
|
|
|
|
|
|
my $plugin_package = Dist::Zilla::Util->expand_config_package_name($plugin->[0]); |
122
|
|
|
|
|
|
|
none { |
123
|
|
|
|
|
|
|
$plugin_package eq Dist::Zilla::Util->expand_config_package_name($_) # match by package name |
124
|
|
|
|
|
|
|
or ($plugin->[1] and not ref $plugin->[1] and $plugin->[1] eq $_) # match by moniker |
125
|
|
|
|
|
|
|
} $self->_removed_plugins |
126
|
|
|
|
|
|
|
} map { ref $_ ? $_ : [ $_ ] } @plugins; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
foreach my $plugin_spec (@plugins) |
129
|
|
|
|
|
|
|
{ |
130
|
|
|
|
|
|
|
# these should never be added to develop prereqs |
131
|
|
|
|
|
|
|
next if $plugin_spec->[0] eq 'BlockRelease' # temporary use during development |
132
|
|
|
|
|
|
|
or $plugin_spec->[0] eq 'VerifyPhases'; # only used by TABULO, not others |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my $plugin = Dist::Zilla::Util->expand_config_package_name($plugin_spec->[0]); |
135
|
|
|
|
|
|
|
require_module($plugin); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
push @$plugin_spec, {} if not ref $plugin_spec->[-1]; |
138
|
|
|
|
|
|
|
my $payload = $plugin_spec->[-1]; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my %extra_args = %{ $self->_extra_args }; |
141
|
|
|
|
|
|
|
foreach my $module (grep { $plugin->isa($_) or $plugin->does($_) } keys %extra_args) |
142
|
|
|
|
|
|
|
{ |
143
|
|
|
|
|
|
|
my %configs = %{ $extra_args{$module} }; # copy, not reference! |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# don't keep :version unless it matches the package exactly, but still respect the prereq |
146
|
|
|
|
|
|
|
$self->_add_minimum_develop_suggests($module => delete $configs{':version'}) |
147
|
|
|
|
|
|
|
if exists $configs{':version'} and $module ne $plugin; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# we don't need to worry about overwriting the payload with defaults, as |
150
|
|
|
|
|
|
|
# ConfigSlicer will copy them back over later on. |
151
|
|
|
|
|
|
|
@{$payload}{keys %configs} = values %configs; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# record develop prereq |
155
|
|
|
|
|
|
|
$self->_add_minimum_develop_suggests($plugin => $payload->{':version'} // 0); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
return $self->$orig(@plugins); |
159
|
|
|
|
|
|
|
}; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
####################################### |
164
|
|
|
|
|
|
|
around add_bundle => sub |
165
|
|
|
|
|
|
|
####################################### |
166
|
|
|
|
|
|
|
{ |
167
|
|
|
|
|
|
|
my ($orig, $self, $bundle, $payload) = @_; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
return if $self->_plugin_removed($bundle); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my $package = Dist::Zilla::Util->expand_config_package_name($bundle); |
172
|
|
|
|
|
|
|
&use_module( |
173
|
|
|
|
|
|
|
$package, |
174
|
|
|
|
|
|
|
$payload && $payload->{':version'} ? $payload->{':version'} : (), |
175
|
|
|
|
|
|
|
); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# default configs can be passed in directly - no need to consult %extra_args |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# record develop prereq of bundle only, not its components (it should do that itself) |
180
|
|
|
|
|
|
|
$self->_add_minimum_develop_suggests($package => $payload->{':version'} // 0); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# allow config slices to propagate down from the user |
183
|
|
|
|
|
|
|
$payload = { |
184
|
|
|
|
|
|
|
%$payload, # caller bundle's default settings for this bundle, passed to this sub |
185
|
|
|
|
|
|
|
# custom configs from the user, which may override defaults |
186
|
|
|
|
|
|
|
(map { $_ => $self->payload->{$_} } grep { /^(.+?)\.(.+?)/ } keys %{ $self->payload }), |
187
|
|
|
|
|
|
|
}; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# allow the user to say -remove = <plugin added in subbundle>, but also do not override |
190
|
|
|
|
|
|
|
# any removals that were passed into this sub directly. |
191
|
|
|
|
|
|
|
push @{$payload->{-remove}}, @{ $self->payload->{ $self->plugin_remover_attribute } } |
192
|
|
|
|
|
|
|
if $self->payload->{ $self->plugin_remover_attribute }; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
return $self->$orig($bundle, $payload); |
195
|
|
|
|
|
|
|
}; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
1; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=pod |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=encoding UTF-8 |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 NAME |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Banal::Dist::Zilla::Role::PluginBundle::Easier - The base class for TABULO's plugin bundle for distributions built by TABULO |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 VERSION |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
version 0.198 |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 SYNOPSIS |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
In your F<dist.ini>: |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
[@Author::TABULO] |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head1 DESCRIPTION |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=for stopwords TABULO |
222
|
|
|
|
|
|
|
=for stopwords GitHub DZIL |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This is a practical utility role that attempts to simplify writing DZIL plugin bundles. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 WARNING |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Please note that, although this module needs to be on CPAN for obvious reasons, |
229
|
|
|
|
|
|
|
it is really intended to be a collection of personal preferences, which are |
230
|
|
|
|
|
|
|
expected to be in great flux, at least for the time being. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Therefore, please do NOT base your own distributions on this one, since anything |
233
|
|
|
|
|
|
|
can change at any moment without prior notice, while I get accustomed to dzil |
234
|
|
|
|
|
|
|
myself and form those preferences in the first place... |
235
|
|
|
|
|
|
|
Absolutely nothing in this distribution is guaranteed to remain constant or |
236
|
|
|
|
|
|
|
be maintained at this point. Who knows, I may even give up on dzil altogether... |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
You have been warned. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 SEE ALSO |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=over 4 |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item * |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::TABULO> |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=back |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 SUPPORT |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-PluginBundle-Author-TABULO> |
253
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org|mailto:bug-Dist-Zilla-PluginBundle-Author-TABULO@rt.cpan.org>). |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head1 AUTHOR |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Tabulo <tabulo@cpan.org> |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Tabulo. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
264
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=cut |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
__END__ |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
#region pod |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
#endregion pod |