[Bps-public-commit] Shipwright branch, master, updated. 2f5b032809ff06fad17a6fc05f9ff34bb1501f4a

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jul 30 23:22:37 EDT 2009


The branch, master has been updated
       via  2f5b032809ff06fad17a6fc05f9ff34bb1501f4a (commit)
      from  9826f75ddc731fc7ffd224fde979eab10aa35c13 (commit)

Summary of changes:
 lib/Shipwright/Backend/Base.pm |   12 ++++++------
 lib/Shipwright/Backend/FS.pm   |    6 +++---
 lib/Shipwright/Backend/Git.pm  |    5 +++--
 lib/Shipwright/Backend/SVK.pm  |    7 ++++---
 lib/Shipwright/Source/Git.pm   |    9 ++++-----
 5 files changed, 20 insertions(+), 19 deletions(-)

- Log -----------------------------------------------------------------
commit 2f5b032809ff06fad17a6fc05f9ff34bb1501f4a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 31 11:06:05 2009 +0800

    go on the replacement

diff --git a/lib/Shipwright/Backend/Base.pm b/lib/Shipwright/Backend/Base.pm
index 51c9975..54a644c 100644
--- a/lib/Shipwright/Backend/Base.pm
+++ b/lib/Shipwright/Backend/Base.pm
@@ -7,7 +7,7 @@ use File::Spec::Functions qw/catfile catdir splitpath/;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
 use File::Copy::Recursive qw/rcopy/;
-use File::Path;
+use File::Path qw/make_path remove_tree/;
 use List::MoreUtils qw/uniq firstidx/;
 use Module::Info;
 
@@ -87,7 +87,7 @@ sub _install_module_build {
     my $self = shift;
     my $dir = shift;
     my $module_build_path = catdir( $dir, 'inc', 'Module', );
-    mkpath catdir( $module_build_path, 'Build' );
+    make_path( catdir( $module_build_path, 'Build' ) );
     rcopy( Module::Info->new_from_module('Module::Build')->file,
             $module_build_path ) or confess "copy Module/Build.pm failed: $!";
     rcopy(
@@ -105,7 +105,7 @@ sub _install_yaml_tiny {
     my $dir = shift;
 
     my $yaml_tiny_path = catdir( $dir, 'inc', 'YAML' );
-    mkpath $yaml_tiny_path;
+    make_path( $yaml_tiny_path );
     rcopy( Module::Info->new_from_module('YAML::Tiny')->file, $yaml_tiny_path )
       or confess "copy YAML/Tiny.pm failed: $!";
 }
@@ -114,7 +114,7 @@ sub _install_clean_inc {
     my $self = shift;
     my $dir = shift;
     my $util_inc_path = catdir( $dir, 'inc', 'Shipwright', 'Util' );
-    mkpath $util_inc_path;
+    make_path( $util_inc_path );
     for my $mod qw(Shipwright::Util::CleanINC Shipwright::Util::PatchModuleBuild) {
         rcopy( Module::Info->new_from_module($mod)->file, $util_inc_path )
             or confess "copy $mod failed: $!";
@@ -126,7 +126,7 @@ sub _install_file_compare {
     my $dir = shift;
 
     my $path = catdir( $dir, 'inc', 'File' );
-    mkpath $path;
+    make_path( $path );
     rcopy( Module::Info->new_from_module('File::Compare')->file, $path )
       or confess "copy File/Compare.pm failed: $!";
 }
@@ -136,7 +136,7 @@ sub _install_file_copy_recursive {
     my $dir = shift;
 
     my $path = catdir( $dir, 'inc', 'File', 'Copy' );
-    mkpath $path;
+    make_path( $path );
     rcopy( Module::Info->new_from_module('File::Copy::Recursive')->file, $path )
       or confess "copy File/Copy/Recursive.pm failed: $!";
 }
diff --git a/lib/Shipwright/Backend/FS.pm b/lib/Shipwright/Backend/FS.pm
index fbcd525..c65f1f1 100644
--- a/lib/Shipwright/Backend/FS.pm
+++ b/lib/Shipwright/Backend/FS.pm
@@ -6,7 +6,7 @@ use Carp;
 use File::Spec::Functions qw/catfile splitdir catdir/;
 use Shipwright::Util;
 use File::Copy::Recursive qw/rcopy rmove/;
-use File::Path;
+use File::Path qw/remove_tree make_path/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/] );
 
@@ -84,7 +84,7 @@ sub _cmd {
                       )
                     {
                         push @cmd, sub {
-                            mkpath(
+                            make_path(
                                 catdir(
                                     $self->repository,
                                     'sources',
@@ -115,7 +115,7 @@ sub _cmd {
         }
     }
     elsif ( $type eq 'delete' ) {
-        @cmd = sub { rmtree( $self->repository . $args{path} ) };
+        @cmd = sub { remove_tree( $self->repository . $args{path} ) };
     }
     elsif ( $type eq 'move' ) {
         @cmd = sub {
diff --git a/lib/Shipwright/Backend/Git.pm b/lib/Shipwright/Backend/Git.pm
index 38c990f..7c84373 100644
--- a/lib/Shipwright/Backend/Git.pm
+++ b/lib/Shipwright/Backend/Git.pm
@@ -9,6 +9,7 @@ use File::Temp qw/tempdir/;
 use File::Copy::Recursive qw/rcopy/;
 use Cwd qw/getcwd/;
 use Shipwright::Backend::FS;
+use File::Path qw/remove_tree make_path/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/] );
 
@@ -40,8 +41,8 @@ sub initialize {
     my $path = $self->repository;
     $path =~ s!^file://!!;    # this is always true since we check that before
 
-    Shipwright::Util->run( [ 'rm', '-rf', $path ] );
-    Shipwright::Util->run( [ 'mkdir', '-p', $path ] );
+    Shipwright::Util->run( sub { remove_tree( $path ) } );
+    Shipwright::Util->run( sub { make_path( $path ) } );
 
     my $cwd = getcwd;
     chdir $path;
diff --git a/lib/Shipwright/Backend/SVK.pm b/lib/Shipwright/Backend/SVK.pm
index 0c5af35..5481e31 100644
--- a/lib/Shipwright/Backend/SVK.pm
+++ b/lib/Shipwright/Backend/SVK.pm
@@ -7,6 +7,7 @@ use File::Spec::Functions qw/catfile/;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
 use File::Copy::Recursive qw/rcopy/;
+use File::Path qw/remove_tree/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/] );
 
@@ -125,10 +126,10 @@ sub _cmd {
                 my $tmp_dir =
                   tempdir( 'shipwright_backend_svk_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
                 @cmd = (
-                    [ 'rm', '-rf', "$tmp_dir" ],
+                    sub { remove_tree( $tmp_dir ) },
                     [ $ENV{'SHIPWRIGHT_SVK'}, 'checkout', $self->repository . $path, $tmp_dir ],
-                    [ 'rm',  '-rf',      "$tmp_dir" ],
-                    [ 'cp', '-r', $source, "$tmp_dir" ],
+                    sub { remove_tree( $tmp_dir ) },
+                    sub { rcopy( $source, $tmp_dir ) },
                     [
                         $ENV{'SHIPWRIGHT_SVK'},      'commit',
                         '--import', $tmp_dir,
diff --git a/lib/Shipwright/Source/Git.pm b/lib/Shipwright/Source/Git.pm
index 83184ad..be19e4e 100644
--- a/lib/Shipwright/Source/Git.pm
+++ b/lib/Shipwright/Source/Git.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/;
 
@@ -58,11 +59,9 @@ sub _run {
 
 # TODO handle the version stuff
 
-    push @cmds,
-    [
-        'rm', '-rf',
-        catdir( $self->download_directory, $self->name, '.git' ),
-    ];
+    push @cmds, sub {
+        remove_tree( catdir( $self->download_directory, $self->name, '.git' ) );
+    };
 
     $self->source( catdir( $self->download_directory, $self->name ) );
     Shipwright::Util->run($_) for @cmds;

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



More information about the Bps-public-commit mailing list