X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FOyster%2FDeploy%2FGit.pm;fp=lib%2FOyster%2FDeploy%2FGit.pm;h=12e4ba0fa9ff6df370522b7c7a49d8734fde287e;hb=6b832bd6eabfef633627b14a5252110b8653e310;hp=9f9f891991d75b4edffebb326f9315732989a094;hpb=83928564ffca265f67e17d34adc15d12d5319537;p=p5sagit%2FOyster.git diff --git a/lib/Oyster/Deploy/Git.pm b/lib/Oyster/Deploy/Git.pm index 9f9f891..12e4ba0 100644 --- a/lib/Oyster/Deploy/Git.pm +++ b/lib/Oyster/Deploy/Git.pm @@ -18,14 +18,28 @@ sub create { mkdir($location); my $git = Git::Wrapper->new($location); + $git->init(); + my ($postreceive, $postupdate); - copy(dist_file( 'Oyster', './deploy/git/post-receive'), ($git->dir . '.git/hooks/')) + eval { + $postreceive = dist_file( 'Oyster', './deploy/git/post-receive'); + $postupdate = dist_file( 'Oyster', './deploy/git/post-update'); + }; + #Beware there be deamons here + if ($@) { + $postreceive = './share/deploy/git/post-receive'; + $postupdate = './share/deploy/git/post-update'; + } + + + copy($postreceive, ($git->dir . '/.git/hooks/')) or Error::Simple->throw('Creating post commit hooks failed.'); - copy(dist_file( 'Oyster', './deploy/git/post-update'), ($git->dir . '.git/hooks/')) + + copy($postupdate, ($git->dir . '/.git/hooks/')) or Error::Simple->throw('Creating post commit hooks failed.'); - chmod(0x755, ('./bin/git/hooks/post-receive', './bin/git/hooks/post-update')); + chmod(0x755, ($git->dir . '.git/hooks/post-receive', $git->dir . '.git/hooks/post-update')); return 1; }