[Bps-public-commit] Shipwright branch, master, updated. 702c805a8332a282721774804f35c5f10a5ffd52

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sat Oct 3 10:36:35 EDT 2009


The branch, master has been updated
       via  702c805a8332a282721774804f35c5f10a5ffd52 (commit)
       via  c1784ba27629b8c061e239e3bebe2ff02798be1e (commit)
      from  13eacbb11050b4d6de11abca48d11c6356350c81 (commit)

Summary of changes:
 lib/Shipwright/Source/SVK.pm |   18 ++++++++----------
 lib/Shipwright/Source/SVN.pm |   18 ++++++------------
 2 files changed, 14 insertions(+), 22 deletions(-)

- Log -----------------------------------------------------------------
commit c1784ba27629b8c061e239e3bebe2ff02798be1e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 3 22:34:42 2009 +0800

    remove export dir if exist for svk source

diff --git a/lib/Shipwright/Source/SVK.pm b/lib/Shipwright/Source/SVK.pm
index 7c358b1..befb79d 100644
--- a/lib/Shipwright/Source/SVK.pm
+++ b/lib/Shipwright/Source/SVK.pm
@@ -4,6 +4,7 @@ use warnings;
 use strict;
 use Carp;
 use File::Spec::Functions qw/catdir/;
+use File::Path qw/remove_tree/;
 
 use base qw/Shipwright::Source::Base/;
 
@@ -51,19 +52,14 @@ sub _run {
     my $source = $self->source;
 
     my @cmds;
+    my $path = catdir( $self->download_directory, $self->name );
     push @cmds,
       [
-        $ENV{'SHIPWRIGHT_SVK'},
-        'co',
-        $self->source,
-        catdir( $self->download_directory, $self->name ),
+        $ENV{'SHIPWRIGHT_SVK'}, 'co',
+        $self->source,          $path,
         $self->version ? ( '-r', $self->version ) : ()
       ];
-    push @cmds,
-      [
-        $ENV{'SHIPWRIGHT_SVK'}, 'co', '-d',
-        catdir( $self->download_directory, $self->name ),
-      ];
+    push @cmds, [ $ENV{'SHIPWRIGHT_SVK'}, 'co', '-d', $path, ];
 
     unless ( $self->version ) {
         my ($out) = Shipwright::Util->run(
@@ -74,7 +70,9 @@ sub _run {
         }
     }
 
-    $self->source( catdir( $self->download_directory, $self->name ) );
+    remove_tree($path) if -e $path;
+
+    $self->source( $path );
     Shipwright::Util->run($_) for @cmds;
 }
 

commit 702c805a8332a282721774804f35c5f10a5ffd52
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 3 22:36:28 2009 +0800

    refactor reb's code a bit: 1. use remove_tree for consistency. 2. consistent names 3. remove_tree will die if fails, no need to confess ourselves

diff --git a/lib/Shipwright/Source/SVN.pm b/lib/Shipwright/Source/SVN.pm
index a882fc9..4fbfb17 100644
--- a/lib/Shipwright/Source/SVN.pm
+++ b/lib/Shipwright/Source/SVN.pm
@@ -4,7 +4,7 @@ use warnings;
 use strict;
 use Carp;
 use File::Spec::Functions qw/catdir/;
-use File::Path;
+use File::Path qw/remove_tree/;
 
 use base qw/Shipwright::Source::Base/;
 
@@ -50,12 +50,10 @@ sub _run {
     my $self   = shift;
     my $source = $self->source;
 
-    my $export_dir = catdir( $self->download_directory, $self->name );
+    my $path = catdir( $self->download_directory, $self->name );
     my $cmd = [
-        $ENV{'SHIPWRIGHT_SVN'},
-        'export',
-        $self->source,
-	$export_dir,
+        $ENV{'SHIPWRIGHT_SVN'}, 'export',
+        $self->source,          $path,
         $self->version ? ( '-r', $self->version ) : (),
     ];
 
@@ -68,12 +66,8 @@ sub _run {
         }
     }
 
-    if( -d $export_dir ) {
-      File::Path::rmtree($export_dir);
-      -d $export_dir
-	and confess "could not remove old export dir '$export_dir'";
-    }
-    $self->source( $export_dir );
+    remove_tree($path) if -e $path;
+    $self->source( $path );
     Shipwright::Util->run($cmd);
 }
 

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



More information about the Bps-public-commit mailing list