| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::GitHooks::Plugin::Test::CustomReply; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
79683
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
94
|
|
|
4
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
71
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
10
|
use base 'App::GitHooks::Plugin'; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
1062
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# External dependencies. |
|
9
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
136
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Internal dependencies. |
|
12
|
3
|
|
|
3
|
|
1067
|
use App::GitHooks::Constants qw( :PLUGIN_RETURN_CODES ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
752
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
App::GitHooks::Plugin::Test::CustomReply - A test plugin that allows specifying the return code. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use App::GitHooks::Constants qw( :PLUGIN_RETURN_CODES ); |
|
26
|
|
|
|
|
|
|
use App::GitHooks::Plugin::Test::CustomReply; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# In .githooksrc. |
|
29
|
|
|
|
|
|
|
# [Test::CustomReply] |
|
30
|
|
|
|
|
|
|
# pre-commit = PLUGIN_RETURN_FAILED |
|
31
|
|
|
|
|
|
|
# prepare-commit-msg = PLUGIN_RETURN_PASSED |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Run hooks calling the plugin. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Version 1.7.3 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
our $VERSION = '1.7.3'; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $HOOK_REPLIES; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 get_file_pattern() |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Return a pattern to filter the files this plugin should analyze. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $file_pattern = App::GitHooks::Plugin::Test::CustomReply->get_file_pattern( |
|
54
|
|
|
|
|
|
|
app => $app, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_file_pattern |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
1
|
|
|
1
|
1
|
27883
|
return qr//x; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 get_file_check_description() |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Return a description of the check performed on files by the plugin and that |
|
68
|
|
|
|
|
|
|
will be displayed to the user, if applicable, along with an indication of the |
|
69
|
|
|
|
|
|
|
success or failure of the plugin. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $description = App::GitHooks::Plugin::Test::CustomReply->get_file_check_description(); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub get_file_check_description |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
1
|
|
|
1
|
1
|
25529
|
return 'Test plugin - custom return codes.'; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SUPPORTED HOOKS |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This plugin supports all the hooks defined in C, |
|
84
|
|
|
|
|
|
|
including file-level checks for the appropriate hooks: |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 4 |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item run_applypatch_msg |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item run_commit_msg |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item run_post_applypatch |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item run_post_checkout |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item run_post_commit |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item run_post_merge |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item run_post_receive |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item run_post_rewrite |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item run_post_update |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item run_pre_applypatch |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item run_pre_auto_gc |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item run_pre_commit |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item run_pre_commit_file |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item run_pre_push |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item run_pre_rebase |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item run_pre_receive |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item run_prepare_commit_msg |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item run_update |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=back |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
foreach my $hook ( @$App::GitHooks::Plugin::SUPPORTED_SUBS ) |
|
129
|
|
|
|
|
|
|
{ |
|
130
|
3
|
|
|
3
|
|
17
|
no strict 'refs'; ## no critic (TestingAndDebugging::ProhibitNoStrict) |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
618
|
|
|
131
|
|
|
|
|
|
|
my $sub = 'run_' . $hook; |
|
132
|
|
|
|
|
|
|
*$sub = sub |
|
133
|
|
|
|
|
|
|
{ |
|
134
|
0
|
|
|
0
|
|
|
my ( $class, %args ) = @_; |
|
135
|
0
|
|
|
|
|
|
my $app = delete( $args{'app'} ); |
|
136
|
0
|
|
|
|
|
|
my $config = $app->get_config(); |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
0
|
|
|
|
my $return = $config->get( 'Test::CustomReply', $hook ) // ''; |
|
139
|
0
|
0
|
|
|
|
|
croak "No return value specified for >$hook<." |
|
140
|
|
|
|
|
|
|
if $return !~ /\w/; |
|
141
|
0
|
0
|
|
|
|
|
croak "The return value for >$hook< in the [Test::CustomReply] section of the .githooksrc is not valid." |
|
142
|
|
|
|
|
|
|
if $return !~ /^PLUGIN_RETURN_(?:FAILED|PASSED|WARNED|SKIPPED)$/x; |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
return ${$return}; |
|
|
0
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
}; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 BUGS |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at |
|
152
|
|
|
|
|
|
|
L. |
|
153
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
154
|
|
|
|
|
|
|
your bug as I make changes. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 SUPPORT |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
perldoc App::GitHooks::Plugin::Test::CustomReply |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
You can also look for information at: |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * GitHub's request tracker |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * MetaCPAN |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=back |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
L, |
|
190
|
|
|
|
|
|
|
C<< >>. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Copyright 2013-2015 Guillaume Aubert. |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it under |
|
198
|
|
|
|
|
|
|
the terms of the GNU General Public License version 3 as published by the Free |
|
199
|
|
|
|
|
|
|
Software Foundation. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY |
|
202
|
|
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
203
|
|
|
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
|
206
|
|
|
|
|
|
|
this program. If not, see http://www.gnu.org/licenses/ |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
1; |