Possibly fixed test
[p5sagit/Oyster.git] / .build / 0ey2IQdAX1 / lib / Oyster / Deploy / Git.pm
CommitLineData
6b832bd6 1package Oyster::Deploy::Git;
2
3use Moose;
4use Git::Wrapper;
5use Error::Simple;
6
7use Data::Dumper;
8use File::Copy;
9use File::ShareDir ':ALL';
10
11sub create {
12 my $self = shift;
13 my $location = shift;
14
15
16 if( -f $location || -d $location ) {
17 Error::Simple->throw("$location already exists");
18 }
19
20 mkdir($location);
21 my $git = Git::Wrapper->new($location);
22
23 my $postreceive = module_file('Oyster::Deploy::Git', '../share/deploy/git/post-receive');
24 my $postupdate = module_file('Oyster::Deploy::Git', '../share/deploy/git/post-update');
25
26 copy($postreceive, ($git->dir . '.git/hooks/'))
27 or Error::Simple->throw('Creating post commit hooks failed.');
28 copy($postupdate, ($git->dir . '.git/hooks/'))
29 or Error::Simple->throw('Creating post commit hooks failed.');
30
31 chmod(0x755, ('./bin/git/hooks/post-receive', './bin/git/hooks/post-update'));
32
33 return 1;
34}
35
36
371;