| 1 | package Git::Repository::Plugin::Hooks; | ||||||||||
| 2 | 2 | ▶ | use parent qw(Git::Repository::Plugin); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use 5.008005; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use Carp qw(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use File::Copy qw(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | our $VERSION = "0.04"; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | sub _keywords { qw( | ||||||||
|
Subroutine
_keywords: called CC=1 SCAR=0.0
| |||||||||||
| 14 | install_hook | ||||||||||
| 15 | hook_path | ||||||||||
| 16 | ) } | ||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub install_hook { | ||||||||
|
Subroutine
install_hook: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||
| 19 | 1 | my ($repo, $source, $target) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 1 | my $dest = $repo->hook_path($target); | |||||||||
| 22 | 1 | my $copy_rv = File::Copy::copy($source, $dest); | |||||||||
| 23 | 1 | ▶ | unless ($copy_rv) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | Carp::croak "install_hook failed: $!"; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | my $chmod_rv = chmod 0755, $dest; | |||||||||
| 28 | 1 | ▶ | unless ($chmod_rv) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | Carp::croak "install_hook failed: $!"; | |||||||||
| 30 | } | ||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | sub hook_path { | ||||||||
|
Subroutine
hook_path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 2 | my ($repo, $target) = @_; | |||||||||
| 35 | 2 | return File::Spec->join($repo->git_dir, 'hooks', $target); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 2 | 1; | |||||||||
| 39 | __END__ | ||||||||||