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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Oct 27 21:06:09 EDT 2009


The branch, master has been updated
       via  67babf144e92bcbdcc00578349b2c913a2aef593 (commit)
      from  6b434aec07bcda61381760440de183956fd91cbe (commit)

Summary of changes:
 lib/Shipwright/Backend.pm           |    8 ++++----
 lib/Shipwright/Backend/Base.pm      |    4 ++--
 lib/Shipwright/Backend/FS.pm        |    8 ++++----
 lib/Shipwright/Backend/SVK.pm       |    6 +++---
 lib/Shipwright/Backend/SVN.pm       |    4 ++--
 lib/Shipwright/Source.pm            |    4 ++--
 lib/Shipwright/Source/Base.pm       |    4 ++--
 lib/Shipwright/Source/Compressed.pm |    2 +-
 lib/Shipwright/Source/FTP.pm        |    2 +-
 lib/Shipwright/Source/Git.pm        |    2 +-
 lib/Shipwright/Source/HTTP.pm       |    2 +-
 11 files changed, 23 insertions(+), 23 deletions(-)

- Log -----------------------------------------------------------------
commit 67babf144e92bcbdcc00578349b2c913a2aef593
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 28 08:37:47 2009 +0800

    let's use confess for all dies

diff --git a/lib/Shipwright/Backend.pm b/lib/Shipwright/Backend.pm
index fda75eb..578382d 100644
--- a/lib/Shipwright/Backend.pm
+++ b/lib/Shipwright/Backend.pm
@@ -10,7 +10,7 @@ sub new {
     my $class = shift;
     my %args  = @_;
 
-    croak 'need repository arg' unless exists $args{repository};
+    confess 'need repository arg' unless exists $args{repository};
 
     $args{repository} =~ s/^\s+//;
     $args{repository} =~ s/\s+$//;
@@ -24,16 +24,16 @@ sub new {
     if ( $args{repository} =~ /^([a-z]+)(?:\+([a-z]+))?:/ ) {
         ($backend, $subtype) = ($1, $2);
     } else {
-        croak "invalid repository, doesn't start from xxx: or xxx+yyy:";
+        confess "invalid repository, doesn't start from xxx: or xxx+yyy:";
     }
 
     my $module = Shipwright::Util->find_module(__PACKAGE__, $backend);
     unless ( $module ) {
-        croak "Couldn't find backend implementing '$backend'";
+        confess "Couldn't find backend implementing '$backend'";
     }
 
     $module->require
-        or croak "Couldn't load module '$module'"
+        or confess "Couldn't load module '$module'"
             ." implementing backend '$backend': $@";
     return $module->new(%args);
 }
diff --git a/lib/Shipwright/Backend/Base.pm b/lib/Shipwright/Backend/Base.pm
index 4f97b77..225873a 100644
--- a/lib/Shipwright/Backend/Base.pm
+++ b/lib/Shipwright/Backend/Base.pm
@@ -719,7 +719,7 @@ sub update {
     my $self = shift;
     my %args = @_;
 
-    croak "need path option" unless $args{path};
+    confess "need path option" unless $args{path};
 
     if ( $args{path} =~ m{/$} ) {
         # it's a directory
@@ -740,7 +740,7 @@ sub update {
     }
     else {
 
-        croak "$args{path} seems not shipwright's own file"
+        confess "$args{path} seems not shipwright's own file"
           unless -e catfile( Shipwright::Util->share_root, $args{path} );
 
         return $self->_update_file( $args{path},
diff --git a/lib/Shipwright/Backend/FS.pm b/lib/Shipwright/Backend/FS.pm
index 5dcc747..8e14e9f 100644
--- a/lib/Shipwright/Backend/FS.pm
+++ b/lib/Shipwright/Backend/FS.pm
@@ -73,7 +73,7 @@ sub _cmd {
     $args{path} ||= '';
 
     for ( @{ $REQUIRE_OPTIONS{$type} } ) {
-        croak "$type need option $_" unless $args{$_};
+        confess "$type need option $_" unless $args{$_};
     }
 
     my @cmd;
@@ -159,7 +159,7 @@ sub _cmd {
 
             if ( -d $path ) {
                 my $dh;
-                opendir $dh, $path or die $!;
+                opendir $dh, $path or confess $!;
                 my $dirs = join "\t", grep { /^[^.]/ } readdir $dh;
                 return $dirs;
             }
@@ -174,13 +174,13 @@ sub _cmd {
             return ( 'No such file or directory' ) unless -e $path;
             return ( '', 'Is a directory' ) unless -f $path;
             local $/;
-            open my $fh, '<', $path or die $!;
+            open my $fh, '<', $path or confess $!;
             my $c = <$fh>;
             return $c;
         };
     }
     else {
-        croak "invalid command: $type";
+        confess "invalid command: $type";
     }
 
     return @cmd;
diff --git a/lib/Shipwright/Backend/SVK.pm b/lib/Shipwright/Backend/SVK.pm
index da80ea6..87197b2 100644
--- a/lib/Shipwright/Backend/SVK.pm
+++ b/lib/Shipwright/Backend/SVK.pm
@@ -79,7 +79,7 @@ sub _svnroot {
             return $self->{svnroot} = "file://$svnroot/$1";
         }
     }
-    croak "Can't find determine underlying SVN repository for ". $self->repository;
+    confess "Can't find determine underlying SVN repository for ". $self->repository;
 }
 
 # a cmd generating factory
@@ -91,7 +91,7 @@ sub _cmd {
     $args{comment} ||= '';
 
     for ( @{ $REQUIRE_OPTIONS{$type} } ) {
-        croak "$type need option $_" unless $args{$_};
+        confess "$type need option $_" unless $args{$_};
     }
 
     my @cmd;
@@ -209,7 +209,7 @@ sub _cmd {
         @cmd = [ $ENV{'SHIPWRIGHT_SVN'}, 'cat', $self->_svnroot . $args{path} ];
     }
     else {
-        croak "invalid command: $type";
+        confess "invalid command: $type";
     }
 
     return @cmd;
diff --git a/lib/Shipwright/Backend/SVN.pm b/lib/Shipwright/Backend/SVN.pm
index 78f50c3..d622555 100644
--- a/lib/Shipwright/Backend/SVN.pm
+++ b/lib/Shipwright/Backend/SVN.pm
@@ -89,7 +89,7 @@ sub _cmd {
     $args{comment} ||= '';
 
     for ( @{ $REQUIRE_OPTIONS{$type} } ) {
-        croak "$type need option $_" unless $args{$_};
+        confess "$type need option $_" unless $args{$_};
     }
 
     my @cmd;
@@ -181,7 +181,7 @@ sub _cmd {
         @cmd = [ $ENV{'SHIPWRIGHT_SVN'}, 'cat', $self->repository . $args{path} ];
     }
     else {
-        croak "invalid command: $type";
+        confess "invalid command: $type";
     }
 
     return @cmd;
diff --git a/lib/Shipwright/Source.pm b/lib/Shipwright/Source.pm
index 2e677fa..a2d54e0 100644
--- a/lib/Shipwright/Source.pm
+++ b/lib/Shipwright/Source.pm
@@ -55,7 +55,7 @@ sub new {
         close $fh;
     }
 
-    croak "need source arg" unless exists $args{source};
+    confess "need source arg" unless exists $args{source};
 
     for my $dir (qw/directory download_directory scripts_directory/) {
         make_path( $args{$dir} ) unless -e $args{$dir};
@@ -63,7 +63,7 @@ sub new {
 
     my $type = type( \$args{source} );
 
-    croak "invalid source: $args{source}" unless $type;
+    confess "invalid source: $args{source}" unless $type;
 
     my $module = 'Shipwright::Source::' . $type;
     $module->require;
diff --git a/lib/Shipwright/Source/Base.pm b/lib/Shipwright/Source/Base.pm
index 5d4948e..59b7b58 100644
--- a/lib/Shipwright/Source/Base.pm
+++ b/lib/Shipwright/Source/Base.pm
@@ -512,7 +512,7 @@ EOF
         Shipwright::Util::DumpFile( $require_path, $require );
     }
     else {
-        croak "invalid __require.yml in $path";
+        confess "invalid __require.yml in $path";
     }
 
     # go back to the cwd before we run _follow
@@ -696,7 +696,7 @@ sub _lwp_get {
         print $fh $response->content;
     }
     else {
-        croak "failed to get $source: " . $response->status_line;
+        confess "failed to get $source: " . $response->status_line;
     }
 }
 
diff --git a/lib/Shipwright/Source/Compressed.pm b/lib/Shipwright/Source/Compressed.pm
index a3b31ba..e6b6796 100644
--- a/lib/Shipwright/Source/Compressed.pm
+++ b/lib/Shipwright/Source/Compressed.pm
@@ -61,7 +61,7 @@ sub path {
     $base_dir =~ s![/\\].*!!; 
 
     if ( @$files != grep { /^\Q$base_dir\E/ } @$files ) {
-        croak 'only support compressed file which contains only one directory: '
+        confess 'only support compressed file which contains only one directory: '
           . $base_dir;
     }
 
diff --git a/lib/Shipwright/Source/FTP.pm b/lib/Shipwright/Source/FTP.pm
index 63d27ab..d3fabb1 100644
--- a/lib/Shipwright/Source/FTP.pm
+++ b/lib/Shipwright/Source/FTP.pm
@@ -40,7 +40,7 @@ sub _run {
         $self->_lwp_get($source);
     }
     else {
-        croak "invalid source: $source";
+        confess "invalid source: $source";
     }
 }
 
diff --git a/lib/Shipwright/Source/Git.pm b/lib/Shipwright/Source/Git.pm
index 81761c1..185413e 100644
--- a/lib/Shipwright/Source/Git.pm
+++ b/lib/Shipwright/Source/Git.pm
@@ -92,7 +92,7 @@ sub _run {
         }
         chdir $cwd;
         remove_tree( $path ) if -e $path;
-        rcopy( $cloned_path, $path ) or die $!;
+        rcopy( $cloned_path, $path ) or confess $!;
         remove_tree( catdir( $path, '.git' ) );
     };
 
diff --git a/lib/Shipwright/Source/HTTP.pm b/lib/Shipwright/Source/HTTP.pm
index 93ba5b6..bc890da 100644
--- a/lib/Shipwright/Source/HTTP.pm
+++ b/lib/Shipwright/Source/HTTP.pm
@@ -42,7 +42,7 @@ sub _run {
         $self->_lwp_get($source);
     }
     else {
-        croak "invalid source: $source";
+        confess "invalid source: $source";
     }
     return 1;
 }

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



More information about the Bps-public-commit mailing list