Too much Whitespace
[p5sagit/Oyster.git] / lib / Oyster / Deploy / Git.pm
index 8298724..c70eb8e 100644 (file)
@@ -11,22 +11,36 @@ use File::ShareDir ':ALL';
 sub create {
   my $self = shift;
   my $location = shift;
-  
+
   if( -f $location || -d $location ) {
     Error::Simple->throw("$location already exists");
   }
-  
+
   mkdir($location);
   my $git = Git::Wrapper->new($location);
-  
-  
-  copy(dist_file( 'Oyster', './bin/git/post-receive'), ($git->dir . '.git/hooks/')) 
+  $git->init();
+
+  my ($postreceive, $postupdate);
+
+  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', './bin/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;
 }