[Bps-public-commit] Shipwright branch, master, updated. 67a38e69827347597f82b9f709944204bd7d7c6b

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Apr 26 07:32:04 EDT 2009


The branch, master has been updated
       via  67a38e69827347597f82b9f709944204bd7d7c6b (commit)
      from  8c0966b490fa85203bc81ba8d16e84cf47ec2d4a (commit)

Summary of changes:
 lib/Shipwright/Backend/Git.pm |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 67a38e69827347597f82b9f709944204bd7d7c6b
Author: sunnavy <sunnavy at gmail.com>
Date:   Sun Apr 26 19:31:46 2009 +0800

    refactor Git backend

diff --git a/lib/Shipwright/Backend/Git.pm b/lib/Shipwright/Backend/Git.pm
index 9a23b2d..f1f2f21 100644
--- a/lib/Shipwright/Backend/Git.pm
+++ b/lib/Shipwright/Backend/Git.pm
@@ -115,7 +115,11 @@ sub _cmd {
 
 sub _yml {
     my $self = shift;
-    return $self->fs_backend->_yml(@_);
+    my $return = $self->fs_backend->_yml(@_);
+    if ( @_ > 1 ) {
+        $self->commit;
+    }
+    return $return;
 }
 
 sub info {
@@ -125,12 +129,14 @@ sub info {
 
 sub _update_dir {
     my $self = shift;
-    return $self->fs_backend->_update_dir(@_);
+    $self->fs_backend->_update_dir(@_);
+    $self->commit;
 }
 
 sub _update_file {
     my $self = shift;
-    return $self->fs_backend->_update_file(@_);
+    $self->fs_backend->_update_file(@_);
+    $self->commit;
 }
 
 sub import {
@@ -138,23 +144,43 @@ sub import {
     return $self->fs_backend->import(@_);
 }
 
-sub DESTROY {
+sub commit {
     my $self = shift;
-    my $cwd  = getcwd;
+    my %args =
+      ( comment => 'comment', @_ );    # git doesn't allow comment to be blank
+
     if ( $self->cloned_dir ) {
+        my $cwd = getcwd;
         chdir $self->cloned_dir or return;
 
         Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'add', '.' ] );
 
         #    TODO comment need to be something special
         Shipwright::Util->run(
-            [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', '-m', 'comment' ], 1 );
+            [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', '-m', $args{comment} ], 1 );
         Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'push' ] );
         chdir $cwd;
-
     }
+    return;
 }
 
+#sub DESTROY {
+#    my $self = shift;
+#    my $cwd  = getcwd;
+#    if ( $self->cloned_dir ) {
+#        chdir $self->cloned_dir or return;
+#
+#        Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'add', '.' ] );
+#
+#            TODO comment need to be something special
+#        Shipwright::Util->run(
+#            [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', '-m', 'comment' ], 1 );
+#        Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'push' ] );
+#        chdir $cwd;
+#
+#    }
+#}
+
 =back
 
 =cut

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list