[Bps-public-commit] r14918 - in Shipwright/branches/2.0: lib/Shipwright/Backend lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Aug 8 08:02:12 EDT 2008


Author: sunnavy
Date: Fri Aug  8 08:02:10 2008
New Revision: 14918

Modified:
   Shipwright/branches/2.0/   (props changed)
   Shipwright/branches/2.0/lib/Shipwright/Backend/Base.pm
   Shipwright/branches/2.0/lib/Shipwright/Backend/FS.pm
   Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm
   Shipwright/branches/2.0/lib/Shipwright/Backend/SVN.pm
   Shipwright/branches/2.0/lib/Shipwright/Source/Shipwright.pm

Log:
 r15447 at sunnavys-mb:  sunnavy | 2008-08-08 19:57:12 +0800
 sub _cmd in Backend/ now returns a list of cmds


Modified: Shipwright/branches/2.0/lib/Shipwright/Backend/Base.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Backend/Base.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Backend/Base.pm	Fri Aug  8 08:02:10 2008
@@ -90,8 +90,9 @@
             $self->delete( path => "/t/extra" ) if $args{delete};
 
             $self->log->info( "import extra tests to " . $self->repository );
-            Shipwright::Util->run(
-                $self->_cmd( import => %args, name => $name ) );
+            for my $cmd ( $self->_cmd( import => %args, name => $name ) ) {
+                Shipwright::Util->run($cmd);
+            }
         }
         elsif ( $args{build_script} ) {
             if ( $self->info( path => "/scripts/$name" )
@@ -106,8 +107,9 @@
 
                 $self->log->info(
                     "import $args{source}'s scripts to " . $self->repository );
-                Shipwright::Util->run(
-                    $self->_cmd( import => %args, name => $name ) );
+                for my $cmd ( $self->_cmd( import => %args, name => $name ) ) {
+                    Shipwright::Util->run($cmd);
+                }
                 $self->update_refs;
 
             }
@@ -129,13 +131,16 @@
                 $version->{$name} = $args{version};
                 $self->version($version);
 
-                Shipwright::Util->run(
-                    $self->_cmd( import => %args, name => $name ) );
+                for my $cmd ( $self->_cmd( import => %args, name => $name ) ) {
+                    Shipwright::Util->run($cmd);
+                }
             }
         }
     }
     else {
-        Shipwright::Util->run( $self->_cmd( import => %args, name => $name ) );
+        for my $cmd ( $self->_cmd( import => %args, name => $name ) ) {
+            Shipwright::Util->run($cmd);
+        }
     }
 }
 
@@ -150,7 +155,9 @@
     my $path = $args{path} || '';
     $self->log->info(
         'export ' . $self->repository . "/$path to $args{target}" );
-    Shipwright::Util->run( $self->_cmd( export => %args ) );
+    for my $cmd ( $self->_cmd( export => %args ) ) {
+        Shipwright::Util->run( $cmd );
+    }
 }
 
 =item checkout
@@ -163,7 +170,9 @@
     my $path = $args{path} || '';
     $self->log->info(
         'export ' . $self->repository . "/$path to $args{target}" );
-    Shipwright::Util->run( $self->_cmd( checkout => %args ) );
+    for my $cmd ( $self->_cmd( checkout => %args ) ) {
+        Shipwright::Util->run( $cmd );
+    }
 }
 
 =item commit
@@ -176,7 +185,9 @@
     my $self = shift;
     my %args = @_;
     $self->log->info( 'commit ' . $args{path} );
-    Shipwright::Util->run( $self->_cmd( commit => @_ ), 1 );
+    for my $cmd (  $self->_cmd( commit => @_ ) ) {
+        Shipwright::Util->run( $cmd, 1 );
+    }
 }
 
 
@@ -237,8 +248,8 @@
     my $name    = $args{name};
 
     return if $require->{$name};
-    my $out = Shipwright::Util->run(
-        $self->_cmd( 'cat', path => "/scripts/$name/require.yml" ), 1 );
+    my $out = Shipwright::Util->run( $self->_cmd( 'cat', path =>
+                "/scripts/$name/require.yml" ), 1 );
 
     my $req = Shipwright::Util::Load( $out ) || {};
 
@@ -383,7 +394,9 @@
     my $path = $args{path} || '';
     if ( $self->info( path => $path ) ) {
         $self->log->info( "delete " . $self->repository . $path );
-        Shipwright::Util->run( $self->_cmd( delete => path => $path ), 1 );
+        for my $cmd ( $self->_cmd( delete => path => $path ) ) {
+            Shipwright::Util->run( $cmd, 1 );
+        }
     }
 }
 
@@ -426,12 +439,15 @@
     if ( $self->info( path => $path ) ) {
         $self->log->info(
             "move " . $self->repository . "/$path to /$new_path" );
-        Shipwright::Util->run(
+        for my $cmd (
             $self->_cmd(
                 move     => path => $path,
                 new_path => $new_path,
-            ),
-        );
+            )
+          )
+        {
+            Shipwright::Util->run($cmd);
+        }
     }
 }
 
@@ -605,8 +621,8 @@
         # initialize here, in case we don't have $name entry in $refs
         $refs->{$name} ||= 0;
 
-        my $out = Shipwright::Util->run(
-            $self->_cmd( 'cat', path => "/scripts/$name/require.yml" ), 1 );
+        my $out = Shipwright::Util->run( $self->_cmd( 'cat', path =>
+                    "/scripts/$name/require.yml"), 1 );
 
         my $req = Shipwright::Util::Load($out) || {};
 

Modified: Shipwright/branches/2.0/lib/Shipwright/Backend/FS.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Backend/FS.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Backend/FS.pm	Fri Aug  8 08:02:10 2008
@@ -51,27 +51,27 @@
         croak "$type need option $_" unless $args{$_};
     }
 
-    my $cmd;
+    my @cmd;
 
     if ( $type eq 'checkout' || $type eq 'export' ) {
-        $cmd = [ 'cp', '-r', $self->repository . $args{path}, $args{target} ];
+        @cmd = [ 'cp', '-r', $self->repository . $args{path}, $args{target} ];
     }
     elsif ( $type eq 'import' ) {
         if ( $args{_extra_tests} ) {
-            $cmd = [
+            @cmd = [
                 'cp', '-r',
                 $args{source}, $self->repository . '/t/extra'
             ];
         }
         else {
             if ( my $script_dir = $args{build_script} ) {
-                $cmd = [
+                @cmd = [
                     'cp',        '-r',
                     "$script_dir/", $self->repository . "/scripts/$args{name}",
                 ];
             }
             else {
-                $cmd = [
+                @cmd = [
                     'cp',          '-r',
                     "$args{source}/", $self->repository .
                         "/sources/$args{name}/$args{as}",
@@ -80,26 +80,26 @@
         }
     }
     elsif ( $type eq 'delete' ) {
-        $cmd = [ 'rm', '-rf', $self->repository . $args{path}, ];
+        @cmd = [ 'rm', '-rf', $self->repository . $args{path}, ];
     }
     elsif ( $type eq 'move' ) {
-        $cmd = [
+        @cmd = [
             'mv',
             $self->repository . $args{path},
             $self->repository . $args{new_path}
         ];
     }
     elsif ( $type eq 'info' || $type eq 'list' ) {
-        $cmd = [ 'ls', $self->repository . $args{path} ];
+        @cmd = [ 'ls', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        $cmd = [ 'cat', $self->repository . $args{path} ];
+        @cmd = [ 'cat', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";
     }
 
-    return $cmd;
+    return @cmd;
 }
 
 =item _yml

Modified: Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm	Fri Aug  8 08:02:10 2008
@@ -54,38 +54,38 @@
         croak "$type need option $_" unless $args{$_};
     }
 
-    my $cmd;
+    my @cmd;
 
     if ( $type eq 'checkout' ) {
         if ( $args{detach} ) {
-            $cmd = [ 'svk', 'checkout', '-d', $args{target} ];
+            @cmd = [ 'svk', 'checkout', '-d', $args{target} ];
         }
         else {
-            $cmd = [
+            @cmd = [
                 'svk',                           'checkout',
                 $self->repository . $args{path}, $args{target}
             ];
         }
     }
     elsif ( $type eq 'export' ) {
-        $cmd =
+        @cmd =
           [ 'svk', 'checkout', $self->repository . $args{path}, $args{target} ];
 
-        #            $cmd = [ 'svk', 'checkout', '-d', $args{target} ];
+        #            @cmd = [ 'svk', 'checkout', '-d', $args{target} ];
     }
     elsif ( $type eq 'list' ) {
-        $cmd = [ 'svk', 'list', $self->repository . $args{path} ];
+        @cmd = [ 'svk', 'list', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'import' ) {
         if ( $args{_initialize} ) {
-            $cmd = [
+            @cmd = [
                 'svk',         'import',
                 $args{source}, $self->repository,
                 '-m',          q{'} . $args{comment} . q{'},
             ];
         }
         elsif ( $args{_extra_tests} ) {
-            $cmd = [
+            @cmd = [
                 'svk', 'import',
                 $args{source}, $self->repository . '/t/extra',
                 '-m', q{'} . $args{comment} . q{'},
@@ -93,14 +93,14 @@
         }
         else {
             if ( my $script_dir = $args{build_script} ) {
-                $cmd = [
+                @cmd = [
                     'svk',       'import',
                     $script_dir, $self->repository . "/scripts/$args{name}/",
                     '-m',        q{'} . $args{comment} . q{'},
                 ];
             }
             else {
-                $cmd = [
+                @cmd = [
                     'svk',         'import',
                     $args{source}, $self->repository .
                         "/sources/$args{name}/$args{as}",
@@ -110,17 +110,17 @@
         }
     }
     elsif ( $type eq 'commit' ) {
-        $cmd =
+        @cmd =
           [ 'svk', 'commit', '-m', q{'} . $args{comment} . q{'}, $args{path} ];
     }
     elsif ( $type eq 'delete' ) {
-        $cmd = [
+        @cmd = [
             'svk', 'delete', '-m', q{'} . 'delete repository' . q{'},
             $self->repository . $args{path},
         ];
     }
     elsif ( $type eq 'move' ) {
-        $cmd = [
+        @cmd = [
             'svk',
             'move',
             '-m',
@@ -130,16 +130,16 @@
         ];
     }
     elsif ( $type eq 'info' ) {
-        $cmd = [ 'svk', 'info', $self->repository . $args{path} ];
+        @cmd = [ 'svk', 'info', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        $cmd = [ 'svk', 'cat', $self->repository . $args{path} ];
+        @cmd = [ 'svk', 'cat', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";
     }
 
-    return $cmd;
+    return @cmd;
 }
 
 sub _yml {

Modified: Shipwright/branches/2.0/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Backend/SVN.pm	Fri Aug  8 08:02:10 2008
@@ -65,26 +65,26 @@
         croak "$type need option $_" unless $args{$_};
     }
 
-    my $cmd;
+    my @cmd;
 
     if ( $type eq 'checkout' ) {
-        $cmd =
+        @cmd =
           [ 'svn', 'checkout', $self->repository . $args{path}, $args{target} ];
     }
     elsif ( $type eq 'export' ) {
-        $cmd =
+        @cmd =
           [ 'svn', 'export', $self->repository . $args{path}, $args{target} ];
     }
     elsif ( $type eq 'import' ) {
         if ( $args{_initialize} ) {
-            $cmd = [
+            @cmd = [
                 'svn',         'import',
                 $args{source}, $self->repository,
                 '-m',          q{'} . $args{comment} . q{'}
             ];
         }
         elsif ( $args{_extra_tests} ) {
-            $cmd = [
+            @cmd = [
                 'svn', 'import',
                 $args{source}, $self->repository . 't/extra',
                 '-m', q{'} . $args{comment} . q{'},
@@ -92,14 +92,14 @@
         }
         else {
             if ( my $script_dir = $args{build_script} ) {
-                $cmd = [
+                @cmd = [
                     'svn',       'import',
                     $script_dir, $self->repository . "/scripts/$args{name}/",
                     '-m',        q{'} . $args{comment} || '' . q{'},
                 ];
             }
             else {
-                $cmd = [
+                @cmd = [
                     'svn',         'import',
                     $args{source}, $self->repository .
                         "/sources/$args{name}/$args{as}",
@@ -109,20 +109,20 @@
         }
     }
     elsif ( $type eq 'list' ) {
-        $cmd = [ 'svn', 'list', $self->repository . $args{path} ];
+        @cmd = [ 'svn', 'list', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'commit' ) {
-        $cmd =
+        @cmd =
           [ 'svn', 'commit', '-m', q{'} . $args{comment} . q{'}, $args{path} ];
     }
     elsif ( $type eq 'delete' ) {
-        $cmd = [
+        @cmd = [
             'svn', 'delete', '-m', q{'} . 'delete' . $args{path} . q{'},
             $self->repository . $args{path}
         ];
     }
     elsif ( $type eq 'move' ) {
-        $cmd = [
+        @cmd = [
             'svn',
             'move',
             '-m',
@@ -132,16 +132,16 @@
         ];
     }
     elsif ( $type eq 'info' ) {
-        $cmd = [ 'svn', 'info', $self->repository . $args{path} ];
+        @cmd = [ 'svn', 'info', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        $cmd = [ 'svn', 'cat', $self->repository . $args{path} ];
+        @cmd = [ 'svn', 'cat', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";
     }
 
-    return $cmd;
+    return @cmd;
 }
 
 sub _yml {

Modified: Shipwright/branches/2.0/lib/Shipwright/Source/Shipwright.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Source/Shipwright.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Source/Shipwright.pm	Fri Aug  8 08:02:10 2008
@@ -38,7 +38,8 @@
     if ( $self->follow ) {
         my $out = Shipwright::Util->run(
             $source_shipwright->backend->_cmd(
-                'cat', path => "/scripts/$dist/require.yml"
+                'cat',
+                path => "/scripts/$dist/require.yml",
             ),
             1
         );



More information about the Bps-public-commit mailing list