line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: syntax=perl |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2020-2023 Sven Kirmess |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any |
6
|
|
|
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above |
7
|
|
|
|
|
|
|
# copyright notice and this permission notice appear in all copies. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
10
|
|
|
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
11
|
|
|
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
12
|
|
|
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
13
|
|
|
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
14
|
|
|
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15
|
|
|
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
1705
|
use 5.006; |
|
2
|
|
|
|
|
11
|
|
18
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
43
|
|
19
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Code::FileMunger; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.008'; |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
|
542
|
use Moose; |
|
2
|
|
|
|
|
453981
|
|
|
2
|
|
|
|
|
11
|
|
26
|
2
|
|
|
2
|
|
14411
|
use namespace::autoclean; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
22
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger'; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
|
180
|
use Carp qw(confess); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
165
|
|
31
|
2
|
|
|
2
|
|
692
|
use Config::MVP 2.200012 (); # https://github.com/rjbs/Config-MVP/issues/13 |
|
2
|
|
|
|
|
176
|
|
|
2
|
|
|
|
|
65
|
|
32
|
2
|
|
|
2
|
|
450
|
use MooseX::Types::Moose qw(CodeRef); |
|
2
|
|
|
|
|
55777
|
|
|
2
|
|
|
|
|
14
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has munge_file => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'CodeRef', |
37
|
|
|
|
|
|
|
reader => '_munge_file', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has munge_files => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => 'CodeRef', |
43
|
|
|
|
|
|
|
reader => '_munge_files', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub BUILD { |
47
|
5
|
|
|
5
|
0
|
19
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
|
49
|
5
|
100
|
100
|
|
|
219
|
confess 'Attribute (munge_file) or (munge_files) is required at constructor ' . __PACKAGE__ . '::new' if !defined $self->_munge_file && !defined $self->_munge_files; |
50
|
|
|
|
|
|
|
|
51
|
4
|
|
|
|
|
134
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub munge_file { |
55
|
2
|
|
|
2
|
0
|
299
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
78
|
my $code_ref = $self->_munge_file; |
58
|
2
|
50
|
|
|
|
18
|
return if !defined $code_ref; |
59
|
2
|
|
|
|
|
18
|
return $self->$code_ref(@_); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
around munge_files => sub { |
63
|
|
|
|
|
|
|
my $next = shift; |
64
|
|
|
|
|
|
|
my $self = shift; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $code_ref = $self->_munge_files; |
67
|
|
|
|
|
|
|
return $self->$code_ref() if defined $code_ref; |
68
|
|
|
|
|
|
|
return $self->$next(); |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=pod |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=encoding UTF-8 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Code::FileMunger - something that munges files within the distribution |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Version 0.008 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle (munge_file) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
use Moose; |
96
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle'; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub bundle_config { |
99
|
|
|
|
|
|
|
my ( $class, $section ) = @_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my @plugins; |
102
|
|
|
|
|
|
|
push @plugins, [ |
103
|
|
|
|
|
|
|
'SomeUniqueName', |
104
|
|
|
|
|
|
|
'Dist::Zilla::Plugin::Code::FileMunger', |
105
|
|
|
|
|
|
|
{ |
106
|
|
|
|
|
|
|
munge_file => sub { |
107
|
|
|
|
|
|
|
my ($self) = @_; |
108
|
|
|
|
|
|
|
$self->log('Hello world'); |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
]; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return @plugins; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle (munge_files) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Moose; |
121
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle'; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub bundle_config { |
124
|
|
|
|
|
|
|
my ( $class, $section ) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my @plugins; |
127
|
|
|
|
|
|
|
push @plugins, [ |
128
|
|
|
|
|
|
|
'SomeUniqueName', |
129
|
|
|
|
|
|
|
'Dist::Zilla::Plugin::Code::FileMunger', |
130
|
|
|
|
|
|
|
{ |
131
|
|
|
|
|
|
|
munge_files => sub { |
132
|
|
|
|
|
|
|
my ($self) = @_; |
133
|
|
|
|
|
|
|
$self->log('Hello world'); |
134
|
|
|
|
|
|
|
}, |
135
|
|
|
|
|
|
|
}, |
136
|
|
|
|
|
|
|
]; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
return @plugins; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle::Easy (munge_file) |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
use Moose; |
146
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Easy'; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub configure { |
149
|
|
|
|
|
|
|
my ( $self ) = @_; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$self->add_plugins([ |
152
|
|
|
|
|
|
|
'Code::FileMunger', |
153
|
|
|
|
|
|
|
{ |
154
|
|
|
|
|
|
|
munge_file => sub { |
155
|
|
|
|
|
|
|
my ($self) = @_; |
156
|
|
|
|
|
|
|
$self->log('Hello world'); |
157
|
|
|
|
|
|
|
}, |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
]); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
return; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle::Easy (munge_files) |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
use Moose; |
169
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Easy'; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub configure { |
172
|
|
|
|
|
|
|
my ( $self ) = @_; |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
$self->add_plugins([ |
175
|
|
|
|
|
|
|
'Code::FileMunger', |
176
|
|
|
|
|
|
|
{ |
177
|
|
|
|
|
|
|
munge_files => sub { |
178
|
|
|
|
|
|
|
my ($self) = @_; |
179
|
|
|
|
|
|
|
$self->log('Hello world'); |
180
|
|
|
|
|
|
|
}, |
181
|
|
|
|
|
|
|
}, |
182
|
|
|
|
|
|
|
]); |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
return; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 DESCRIPTION |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This plugin implements the L<Dist::Zilla::Role::FileMunger> role. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 SUPPORT |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
196
|
|
|
|
|
|
|
at L<https://github.com/skirmess/Dist-Zilla-Plugin-Code/issues>. |
197
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 Source Code |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
202
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
L<https://github.com/skirmess/Dist-Zilla-Plugin-Code> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
git clone https://github.com/skirmess/Dist-Zilla-Plugin-Code.git |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head1 AUTHOR |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Sven Kirmess <sven.kirmess@kzone.ch> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 SEE ALSO |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L<Dist::Zilla>, L<Dist::Zilla::Role::FileMunger> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=cut |