| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
164543
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
64
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Run; # git description: 0.047-5-gcc22469 |
|
5
|
|
|
|
|
|
|
# ABSTRACT: Run external commands and code at specific phases of Dist::Zilla |
|
6
|
|
|
|
|
|
|
# KEYWORDS: plugin tool distribution build release run command shell execute |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.048'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
1; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__END__ |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=encoding UTF-8 |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Run - Run external commands and code at specific phases of Dist::Zilla |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 VERSION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
version 0.048 |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
[Run::AfterBuild] |
|
29
|
|
|
|
|
|
|
run = script/do_this.pl --dir %d --version %v |
|
30
|
|
|
|
|
|
|
run = script/do_that.pl |
|
31
|
|
|
|
|
|
|
eval = unlink scratch.dat |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
[Run::BeforeBuild] |
|
34
|
|
|
|
|
|
|
fatal_errors = 0 |
|
35
|
|
|
|
|
|
|
run = script/do_this.pl --version %v |
|
36
|
|
|
|
|
|
|
run = script/do_that_crashy_thing.pl |
|
37
|
|
|
|
|
|
|
eval = if ($ENV{SOMETHING}) { |
|
38
|
|
|
|
|
|
|
eval = $_[0]->log('some message') |
|
39
|
|
|
|
|
|
|
eval = } |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
[Run::BeforeArchive] |
|
42
|
|
|
|
|
|
|
run = script/myapp_before1.pl %d %v |
|
43
|
|
|
|
|
|
|
run = script/myapp_before2.pl %n %v |
|
44
|
|
|
|
|
|
|
run_no_trial = script/no_execution_on_trial.pl %n %v |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
[Run::BeforeRelease] |
|
47
|
|
|
|
|
|
|
run = script/myapp_before1.pl %a |
|
48
|
|
|
|
|
|
|
run = script/myapp_before2.pl %n %v |
|
49
|
|
|
|
|
|
|
run_no_trial = script/no_execution_on_trial.pl %n %v |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
[Run::Release] |
|
52
|
|
|
|
|
|
|
run = script/myapp_deploy1.pl %a |
|
53
|
|
|
|
|
|
|
run = deployer.pl --dir %d --tgz %a --name %n --version %v |
|
54
|
|
|
|
|
|
|
run_no_trial = script/no_execution_on_trial.pl --dir %d --tgz %a --name %n --version %v |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
[Run::AfterRelease] |
|
57
|
|
|
|
|
|
|
run = script/myapp_after.pl --archive %a --dir %d --version %v |
|
58
|
|
|
|
|
|
|
; %p can be used as the path separator if you have contributors on a different OS |
|
59
|
|
|
|
|
|
|
run = script%pmyapp_after.pl --archive %a --dir %d --version %v |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
[Run::AfterRelease / MyAppAfter] |
|
62
|
|
|
|
|
|
|
run = script/myapp_after.pl --archive %a --dir %d --version %v |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
[Run::Test] |
|
65
|
|
|
|
|
|
|
run = script/tester.pl --name %n --version %v some_file.ext |
|
66
|
|
|
|
|
|
|
run_if_release = ./Build install |
|
67
|
|
|
|
|
|
|
run_if_release = make install |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
[Run::AfterMint] |
|
70
|
|
|
|
|
|
|
run = some command %d |
|
71
|
|
|
|
|
|
|
eval = unlink scratch.dat |
|
72
|
|
|
|
|
|
|
eval = print "I just minted %n for you. Have a nice day!\n"; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Run arbitrary commands and code at various L<Dist::Zilla> phases. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 PARAMETERS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 run |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Run the specific command at the specific L<Dist::Zilla> phase given by the |
|
83
|
|
|
|
|
|
|
plugin. For example, C<[Run::Release]> runs during the release phase. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 run_if_trial |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Only run the given command if this is a I<trial> build or release. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 run_no_trial |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Only run the given command if this isn't a I<trial> build or release. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 run_if_release |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Only run the given command if this is a release. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 run_no_release |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Only run a given command if this isn't a release. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 eval |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Treats the input as a list of lines of Perl code; the code is evaluated at the |
|
104
|
|
|
|
|
|
|
specific L<Dist::Zilla> phase given by the plugin. The code is executed in its |
|
105
|
|
|
|
|
|
|
own C<eval> scope, within a subroutine body; C<@_> contains the instance of the |
|
106
|
|
|
|
|
|
|
plugin executing the code. (Remember that C<shift> in an C<eval> actually |
|
107
|
|
|
|
|
|
|
operates on C<@ARGV>, not C<@_>, so to access the plugin instance, use |
|
108
|
|
|
|
|
|
|
C<$_[0]>.) |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 censor_commands |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Normally, C<run*> commands are included in distribution metadata when used |
|
113
|
|
|
|
|
|
|
with the L<[MetaConfig]|Dist::Zilla::Plugin::MetaConfig> plugin. To bypass |
|
114
|
|
|
|
|
|
|
this, set C<censor_commands = 1>. Additionally, this command is set to true |
|
115
|
|
|
|
|
|
|
automatically when a URL with embedded password is present. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Defaults to false. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 fatal_errors |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
When true, if the C<run> command returns a non-zero exit status or the C<eval> |
|
122
|
|
|
|
|
|
|
command dies, the build will fail. Defaults to true. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 quiet |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
When true, diagnostic messages are not printed (except in C<--verbose> mode). |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Defaults to false. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 EXECUTION ORDER |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
All commands for a given option name are executed together, in the order in |
|
133
|
|
|
|
|
|
|
which they are documented above. Within commands of the same option name, |
|
134
|
|
|
|
|
|
|
order is preserved (from the order provided in F<dist.ini>). |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 ENVIRONMENT |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=for stopwords subshell |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
For executed commands, L<IPC::Open3/open3> is used -- there is no subshell. |
|
141
|
|
|
|
|
|
|
Consequently environment variables may or may not be available depending on |
|
142
|
|
|
|
|
|
|
the individual architecture used. For Perl strings that are evaluated, they |
|
143
|
|
|
|
|
|
|
are done in the dzil process, so all current global variables and other state |
|
144
|
|
|
|
|
|
|
is available for use. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The current working directory is undefined, and may vary depending on the |
|
147
|
|
|
|
|
|
|
version of Dist::Zilla being used. If the state of the filesystem is |
|
148
|
|
|
|
|
|
|
important, explicitly change directories first, or base your relative paths |
|
149
|
|
|
|
|
|
|
off of the build root (available as C<%d>, see below). |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 CONVERSIONS |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
The following conversions/format specifiers are defined |
|
154
|
|
|
|
|
|
|
for passing as arguments to the specified commands and eval strings |
|
155
|
|
|
|
|
|
|
(though not all values are available at all phases). |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over 4 |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
C<%a> the archive of the release (only available to all C<*Release> phases), as documented to be passed to BeforeRelease, Release, AfterRelease plugins |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
C<%o> the directory in which the distribution source originated |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
C<%d> the directory in which the distribution was built (or minted) (not available in C<BeforeBuild>) |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
C<%n> the distribution name |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
C<%p> path separator ('/' on Unix, '\\' on Win32... useful for cross-platform F<dist.ini> files) |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
C<%v> the distribution version, if available (depending on the phase, the C<VersionProvider> plugin may not be able to return a version) |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
C<%t> C<-TRIAL> if the release is a trial release, otherwise the empty string |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
C<%x> full path to the current perl interpreter (like C<$^X> but from L<Config>) |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Additionally C<%s> is retained for backward compatibility (for those plugins that existed |
|
194
|
|
|
|
|
|
|
when it was documented). Each occurrence is replaced by a different value |
|
195
|
|
|
|
|
|
|
(like the regular C<sprintf> function). |
|
196
|
|
|
|
|
|
|
Individual plugins define their own values for the positional replacement of C<%s>. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
B<NOTE>: when using filenames (e.g. C<%d>, C<%n> and C<%x>), be mindful that |
|
199
|
|
|
|
|
|
|
these paths could contain special characters or whitespace, so if they are to |
|
200
|
|
|
|
|
|
|
be used in a shell command, take care to use quotes or escapes! |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 DANGER! SECURITY RISK! |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
The very nature of these plugins is to execute code. Be mindful that your code |
|
205
|
|
|
|
|
|
|
may run on someone else's machine and don't be a jerk! |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 SUPPORT |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Run> |
|
210
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-Run@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Run@rt.cpan.org>). |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
|
213
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
|
216
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 AUTHOR |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> L<https://raudss.us/> |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Randy Stauner Nickolay Platonov Olivier Mengué Al Newkirk Tatsuhiko Miyagawa Thomas Sibley David Golden |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=over 4 |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item * |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Randy Stauner <rwstauner@cpan.org> |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Nickolay Platonov <nplatonov@cpan.org> |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item * |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Olivier Mengué <dolmen@cpan.org> |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item * |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Al Newkirk <github@alnewkirk.com> |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item * |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Tatsuhiko Miyagawa <miyagawa@cpan.org> |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=item * |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Thomas Sibley <tsibley@cpan.org> |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=item * |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=back |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This software is copyright (c) 2010 by L<Raudssus Social Software|https://raudss.us/>. |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
267
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |