| 1 | package App::GitHooks::Hook::PrePush; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | # Inherit from the base Hook class. | ||
| 7 | use base 'App::GitHooks::Hook'; | ||
| 8 | |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | App::GitHooks::Hook::PrePush - Handle the pre-push hook. | ||
| 13 | |||
| 14 | |||
| 15 | =head1 VERSION | ||
| 16 | |||
| 17 | Version 1.7.3 | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | our $VERSION = '1.7.3'; | ||
| 22 | |||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | =head2 run() | ||
| 27 | |||
| 28 | Run the hook handler and return an exit status to pass to git. | ||
| 29 | |||
| 30 | my $exit_status = App::GitHooks::Hook::PrePush->run( | ||
| 31 | app => $app, | ||
| 32 | ); | ||
| 33 | |||
| 34 | Arguments: | ||
| 35 | |||
| 36 | =over 4 | ||
| 37 | |||
| 38 | =item * app I<(mandatory)> | ||
| 39 | |||
| 40 | An App::GitHooks object. | ||
| 41 | |||
| 42 | =back | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | sub run | ||
| 47 | { | ||
| 48 | my ( $class, %args ) = @_; | ||
| 49 | |||
| 50 | # Retrieve stdin, which contains a list of the references being pushed. | ||
| 51 | # It is important to do it once for the whole hook, and then pass it to the | ||
| 52 | # plugins - otherwise the first plugin that reads stdin will leave it empty | ||
| 53 | # for the others and they won't see any changes. | ||
| 54 | $args{'stdin'} = [ <STDIN> ]; ## no critic (InputOutput::ProhibitExplicitStdin) | ||
| 55 | |||
| 56 | return $class->SUPER::run( | ||
| 57 | %args | ||
| 58 | ); | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | =head1 BUGS | ||
| 63 | |||
| 64 | Please report any bugs or feature requests through the web interface at | ||
| 65 | L<https://github.com/guillaumeaubert/App-GitHooks/issues/new>. | ||
| 66 | I will be notified, and then you'll automatically be notified of progress on | ||
| 67 | your bug as I make changes. | ||
| 68 | |||
| 69 | |||
| 70 | =head1 SUPPORT | ||
| 71 | |||
| 72 | You can find documentation for this module with the perldoc command. | ||
| 73 | |||
| 74 | perldoc App::GitHooks::Hook::PrePush | ||
| 75 | |||
| 76 | |||
| 77 | You can also look for information at: | ||
| 78 | |||
| 79 | =over | ||
| 80 | |||
| 81 | =item * GitHub's request tracker | ||
| 82 | |||
| 83 | L<https://github.com/guillaumeaubert/App-GitHooks/issues> | ||
| 84 | |||
| 85 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 86 | |||
| 87 | L<http://annocpan.org/dist/app-githooks> | ||
| 88 | |||
| 89 | =item * CPAN Ratings | ||
| 90 | |||
| 91 | L<http://cpanratings.perl.org/d/app-githooks> | ||
| 92 | |||
| 93 | =item * MetaCPAN | ||
| 94 | |||
| 95 | L<https://metacpan.org/release/App-GitHooks> | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | |||
| 100 | =head1 AUTHOR | ||
| 101 | |||
| 102 | L<Guillaume Aubert|https://metacpan.org/author/AUBERTG>, | ||
| 103 | C<< <aubertg at cpan.org> >>. | ||
| 104 | |||
| 105 | |||
| 106 | =head1 COPYRIGHT & LICENSE | ||
| 107 | |||
| 108 | Copyright 2013-2015 Guillaume Aubert. | ||
| 109 | |||
| 110 | This program is free software: you can redistribute it and/or modify it under | ||
| 111 | the terms of the GNU General Public License version 3 as published by the Free | ||
| 112 | Software Foundation. | ||
| 113 | |||
| 114 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| 115 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| 116 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
| 117 | |||
| 118 | You should have received a copy of the GNU General Public License along with | ||
| 119 | this program. If not, see http://www.gnu.org/licenses/ | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | 1; |