Commit | Line | Data |
40056462 |
1 | package Oyster::Deploy::Git; |
2 | |
3 | use Moose; |
4 | use Git::Wrapper; |
5 | use Error::Simple; |
6 | |
7 | use Data::Dumper; |
47863b26 |
8 | use File::Copy; |
9 | use File::ShareDir ':ALL'; |
40056462 |
10 | |
11 | sub create { |
12 | my $self = shift; |
13 | my $location = shift; |
14 | |
15 | if( -f $location || -d $location ) { |
16 | Error::Simple->throw("$location already exists"); |
17 | } |
18 | |
19 | mkdir($location); |
20 | my $git = Git::Wrapper->new($location); |
21 | |
47863b26 |
22 | |
e74d6d9c |
23 | copy(dist_file( 'Oyster', './deploy/git/post-receive'), ($git->dir . '.git/hooks/')) |
47863b26 |
24 | or Error::Simple->throw('Creating post commit hooks failed.'); |
e74d6d9c |
25 | copy(dist_file( 'Oyster', './deploy/git/post-update'), ($git->dir . '.git/hooks/')) |
47863b26 |
26 | or Error::Simple->throw('Creating post commit hooks failed.'); |
27 | |
28 | chmod(0x755, ('./bin/git/hooks/post-receive', './bin/git/hooks/post-update')); |
29 | |
40056462 |
30 | return 1; |
31 | } |
32 | |
33 | |
47863b26 |
34 | 1; |