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