[Bps-public-commit] Shipwright branch, master, updated. 6b434aec07bcda61381760440de183956fd91cbe

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Oct 27 03:41:41 EDT 2009


The branch, master has been updated
       via  6b434aec07bcda61381760440de183956fd91cbe (commit)
      from  8f78f1f3f1615178ca793ebd9a91bad6a158319b (commit)

Summary of changes:
 lib/Shipwright/Util.pm |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 6b434aec07bcda61381760440de183956fd91cbe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 27 15:40:36 2009 +0800

    add suggest line when error occurs: currently we just suggest people install modules if not installed

diff --git a/lib/Shipwright/Util.pm b/lib/Shipwright/Util.pm
index cd8c329..ece8b60 100644
--- a/lib/Shipwright/Util.pm
+++ b/lib/Shipwright/Util.pm
@@ -67,8 +67,15 @@ sub run {
         $log->error(
             'failed to run ' . join( ' ', @$cmd ) . " with exit number $?" );
         unless ($ignore_failure) {
-	    $out = "\n$out" if length $out;
-	    $err = "\n$err" if length $err;
+            $out = "\n$out" if length $out;
+            $err = "\n$err" if length $err;
+            my $suggest = '';
+            if ( $err && $err =~ /Can't locate (\S+)\.pm in \@INC/ ) {
+                my $module = $1;
+                $module =~ s!/!::!g;
+                $suggest = "install $module first";
+            }
+
             my $cwd = getcwd;
             confess <<"EOF";
 command failed: @$cmd
@@ -76,8 +83,10 @@ command failed: @$cmd
 cwd: $cwd
 stdout was: $out
 stderr was: $err
+suggest: $suggest
 EOF
         }
+
     }
 
     return wantarray ? ( $out, $err ) : $out;

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



More information about the Bps-public-commit mailing list