Merge branch 'master' of git.shadowcat.co.uk:Oyster
[p5sagit/Oyster.git] / lib / Oyster / Deploy / Git.pm
index 37ff0a8..9f9f891 100644 (file)
@@ -5,6 +5,8 @@ use Git::Wrapper;
 use Error::Simple;
 
 use Data::Dumper;
+use File::Copy;
+use File::ShareDir ':ALL';
 
 sub create {
   my $self = shift;
@@ -17,8 +19,16 @@ sub create {
   mkdir($location);
   my $git = Git::Wrapper->new($location);
   
+  
+  copy(dist_file( 'Oyster', './deploy/git/post-receive'), ($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/')) 
+    or Error::Simple->throw('Creating post commit hooks failed.');
+  
+  chmod(0x755, ('./bin/git/hooks/post-receive', './bin/git/hooks/post-update'));
+  
   return 1;
 }
 
 
-1;
\ No newline at end of file
+1;