| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::GitHooks::Plugin; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 38 |  |  | 38 |  | 15870 | use strict; | 
|  | 38 |  |  |  |  | 38 |  | 
|  | 38 |  |  |  |  | 872 |  | 
| 4 | 38 |  |  | 38 |  | 115 | use warnings; | 
|  | 38 |  |  |  |  | 39 |  | 
|  | 38 |  |  |  |  | 763 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | # External dependencies. | 
| 7 | 38 |  |  | 38 |  | 358 | use Carp; | 
|  | 38 |  |  |  |  | 39 |  | 
|  | 38 |  |  |  |  | 6809 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | =head1 NAME | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | App::GitHooks::Plugin - Base class for plugins. | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 VERSION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | Version 1.8.0 | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =cut | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | our $VERSION = '1.8.0'; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | our $SUPPORTED_SUBS = | 
| 24 |  |  |  |  |  |  | [ | 
| 25 |  |  |  |  |  |  | qw( | 
| 26 |  |  |  |  |  |  | applypatch_msg | 
| 27 |  |  |  |  |  |  | commit_msg | 
| 28 |  |  |  |  |  |  | post_applypatch | 
| 29 |  |  |  |  |  |  | post_checkout | 
| 30 |  |  |  |  |  |  | post_commit | 
| 31 |  |  |  |  |  |  | post_merge | 
| 32 |  |  |  |  |  |  | post_receive | 
| 33 |  |  |  |  |  |  | post_rewrite | 
| 34 |  |  |  |  |  |  | post_update | 
| 35 |  |  |  |  |  |  | pre_applypatch | 
| 36 |  |  |  |  |  |  | pre_auto_gc | 
| 37 |  |  |  |  |  |  | pre_commit | 
| 38 |  |  |  |  |  |  | pre_commit_file | 
| 39 |  |  |  |  |  |  | pre_push | 
| 40 |  |  |  |  |  |  | pre_rebase | 
| 41 |  |  |  |  |  |  | pre_receive | 
| 42 |  |  |  |  |  |  | prepare_commit_msg | 
| 43 |  |  |  |  |  |  | update | 
| 44 |  |  |  |  |  |  | ) | 
| 45 |  |  |  |  |  |  | ]; | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 METHODS | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head2 get_file_check_description() | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | Return a description of the check performed on files by the plugin and that | 
| 53 |  |  |  |  |  |  | will be displayed to the user, if applicable, along with an indication of the | 
| 54 |  |  |  |  |  |  | success or failure of the plugin. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | my $description = $plugin_class->get_file_check_description(); | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =cut | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | sub get_file_check_description | 
| 61 |  |  |  |  |  |  | { | 
| 62 | 1 |  |  | 1 | 1 | 3323 | croak 'You must define a get_file_check_description() subroutine in the plugin'; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head2 get_name() | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | Return the name of the plugin. For example, for C, | 
| 69 |  |  |  |  |  |  | the name will be C. | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | my $name = $plugin->get_name(); | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =cut | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | sub get_name | 
| 76 |  |  |  |  |  |  | { | 
| 77 | 5 |  |  | 5 | 1 | 6330 | my ( $class ) = @_; | 
| 78 | 5 | 100 | 100 |  |  | 44 | croak 'You need to call this method on a class' | 
| 79 |  |  |  |  |  |  | if !defined( $class ) || ( $class eq '' );; | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 3 |  |  |  |  | 4 | my $base_path = __PACKAGE__ . '::'; | 
| 82 | 3 | 100 |  |  |  | 52 | croak "Not a valid plugin class: >$class<" | 
| 83 |  |  |  |  |  |  | if $class !~ /^\Q$base_path\E/; | 
| 84 |  |  |  |  |  |  |  | 
| 85 | 2 |  |  |  |  | 14 | $class =~ s/^$base_path//; | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 2 |  |  |  |  | 10 | return $class; | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =head1 BUGS | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Please report any bugs or feature requests through the web interface at | 
| 94 |  |  |  |  |  |  | L. | 
| 95 |  |  |  |  |  |  | I will be notified, and then you'll automatically be notified of progress on | 
| 96 |  |  |  |  |  |  | your bug as I make changes. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head1 SUPPORT | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | perldoc App::GitHooks::Plugin | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | You can also look for information at: | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =over | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =item * GitHub's request tracker | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | L | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | L | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | L | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =item * MetaCPAN | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | L | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | =back | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head1 AUTHOR | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | L, | 
| 132 |  |  |  |  |  |  | C<<  >>. | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | Copyright 2013-2016 Guillaume Aubert. | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | This code is free software; you can redistribute it and/or modify it under the | 
| 140 |  |  |  |  |  |  | same terms as Perl 5 itself. | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | This program is distributed in the hope that it will be useful, but WITHOUT ANY | 
| 143 |  |  |  |  |  |  | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 
| 144 |  |  |  |  |  |  | PARTICULAR PURPOSE. See the LICENSE file for more details. | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =cut | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | 1; |