line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::Filter 6.029; |
2
|
|
|
|
|
|
|
# ABSTRACT: use another bundle, with some plugins removed |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
3728
|
use Moose; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
24990
|
use Dist::Zilla::Pragmas; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
52
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
28
|
use namespace::autoclean; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
47
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
384
|
use List::Util 1.33 qw(any); |
|
3
|
|
|
|
|
110
|
|
|
3
|
|
|
|
|
448
|
|
12
|
3
|
|
|
3
|
|
23
|
use Module::Runtime qw(use_module); |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
36
|
|
13
|
3
|
|
|
3
|
|
717
|
use Dist::Zilla::Util; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
2198
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod In your F<dist.ini>: |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod [@Filter] |
20
|
|
|
|
|
|
|
#pod -bundle = @Basic |
21
|
|
|
|
|
|
|
#pod -version = 5.031 |
22
|
|
|
|
|
|
|
#pod -remove = ShareDir |
23
|
|
|
|
|
|
|
#pod -remove = UploadToCPAN |
24
|
|
|
|
|
|
|
#pod option = for_basic |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod This plugin bundle actually wraps and modifies another plugin bundle. It |
29
|
|
|
|
|
|
|
#pod includes all the configuration for the bundle named in the C<-bundle> attribute, |
30
|
|
|
|
|
|
|
#pod but removes all the entries whose package is given in the C<-remove> attributes. |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod A minimum required version of the bundle can be specified with the C<-version> |
33
|
|
|
|
|
|
|
#pod attribute. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod Options not prefixed with C<-> will be passed to the bundle to be filtered. |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod B<NOTE:> When you filter a bundle you B<SHOULD NOT> include it directly in |
38
|
|
|
|
|
|
|
#pod your C<dist.ini> file. This plugin will take care of including it for you. |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod Core Dist::Zilla plugins: L<@Basic|Dist::Zilla::PluginBundle::Basic>. |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod Dist::Zilla roles: L<PluginBundle|Dist::Zilla::Role::PluginBundle>. |
45
|
|
|
|
|
|
|
#pod |
46
|
|
|
|
|
|
|
#pod =cut |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
0
|
263
|
sub mvp_multivalue_args { qw(remove -remove) } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub bundle_config { |
51
|
2
|
|
|
2
|
0
|
453
|
my ($self, $section) = @_; |
52
|
2
|
|
33
|
|
|
15
|
my $class = (ref $self) || $self; |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
4
|
my $config = {}; |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
4
|
|
10
|
my $has_filter_args = any { /^-/ } keys %{ $section->{payload} }; |
|
4
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
16
|
|
57
|
2
|
|
|
|
|
13
|
for my $key (keys %{ $section->{payload} }) { |
|
2
|
|
|
|
|
9
|
|
58
|
4
|
|
|
|
|
13
|
my $val = $section->{payload}->{$key}; |
59
|
4
|
50
|
33
|
|
|
19
|
my $target = $has_filter_args && ($key !~ /^-/) |
60
|
|
|
|
|
|
|
? 'bundle' |
61
|
|
|
|
|
|
|
: 'filter'; |
62
|
4
|
50
|
|
|
|
15
|
$key =~ s/^-// if $target eq 'filter'; |
63
|
4
|
|
|
|
|
19
|
$config->{$target}->{$key} = $val; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Carp::croak("no bundle given for bundle filter") |
67
|
2
|
50
|
|
|
|
16
|
unless my $bundle = $config->{filter}->{bundle}; |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
18
|
my $pkg = Dist::Zilla::Util->expand_config_package_name($bundle); |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
78
|
my $version = $config->{filter}->{version}; |
72
|
|
|
|
|
|
|
|
73
|
2
|
50
|
|
|
|
6
|
unless (eval { &use_module($pkg, $version ? $version : ()); 1 }) { |
|
2
|
50
|
|
|
|
21
|
|
|
2
|
|
|
|
|
87
|
|
74
|
|
|
|
|
|
|
# XXX Naughty! -- rjbs, 2013-07-23 |
75
|
0
|
|
|
|
|
0
|
Config::MVP::Section->missing_package($pkg, $bundle); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my @plugins = $pkg->bundle_config({ |
79
|
|
|
|
|
|
|
name => $section->{name}, # not 100% sure about this -- rjbs, 2010-03-06 |
80
|
|
|
|
|
|
|
package => $pkg, |
81
|
|
|
|
|
|
|
payload => $config->{bundle} || {}, |
82
|
2
|
|
50
|
|
|
34
|
}); |
83
|
|
|
|
|
|
|
|
84
|
2
|
50
|
|
|
|
20
|
return @plugins unless my $remove = $config->{filter}->{remove}; |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
15
|
for my $i (reverse 0 .. $#plugins) { |
87
|
|
|
|
|
|
|
splice @plugins, $i, 1 if any(sub { |
88
|
50
|
|
|
50
|
|
474
|
$plugins[$i][1] eq Dist::Zilla::Util->expand_config_package_name($_) |
89
|
34
|
100
|
|
|
|
904
|
}, @$remove); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
66
|
return @plugins; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=pod |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=encoding UTF-8 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 NAME |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Dist::Zilla::PluginBundle::Filter - use another bundle, with some plugins removed |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 VERSION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
version 6.029 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SYNOPSIS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
In your F<dist.ini>: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
[@Filter] |
117
|
|
|
|
|
|
|
-bundle = @Basic |
118
|
|
|
|
|
|
|
-version = 5.031 |
119
|
|
|
|
|
|
|
-remove = ShareDir |
120
|
|
|
|
|
|
|
-remove = UploadToCPAN |
121
|
|
|
|
|
|
|
option = for_basic |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 DESCRIPTION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This plugin bundle actually wraps and modifies another plugin bundle. It |
126
|
|
|
|
|
|
|
includes all the configuration for the bundle named in the C<-bundle> attribute, |
127
|
|
|
|
|
|
|
but removes all the entries whose package is given in the C<-remove> attributes. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
A minimum required version of the bundle can be specified with the C<-version> |
130
|
|
|
|
|
|
|
attribute. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Options not prefixed with C<-> will be passed to the bundle to be filtered. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
B<NOTE:> When you filter a bundle you B<SHOULD NOT> include it directly in |
135
|
|
|
|
|
|
|
your C<dist.ini> file. This plugin will take care of including it for you. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 PERL VERSION |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
140
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
141
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
142
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
145
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
146
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
147
|
|
|
|
|
|
|
the minimum required perl. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 SEE ALSO |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Core Dist::Zilla plugins: L<@Basic|Dist::Zilla::PluginBundle::Basic>. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Dist::Zilla roles: L<PluginBundle|Dist::Zilla::Role::PluginBundle>. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 AUTHOR |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
164
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |