This is an automated email from the git hooks/post-receive script.

abe pushed a commit to annotated tag 0.2.2-source
in repository libdist-zilla-role-bootstrap-perl.

commit f64bef469c1418a9111f58b763b63ad6f0be3157
Author: Kent Fredric <kentfred...@gmail.com>
Date:   Thu Oct 24 08:49:53 2013 +1300

    Make before_script more obvious
---
 before_script.pl | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/before_script.pl b/before_script.pl
index 8c70d73..cc128c7 100644
--- a/before_script.pl
+++ b/before_script.pl
@@ -5,9 +5,10 @@ use warnings;
 use utf8;
 sub diag { print STDERR @_; print STDERR "\n" }
 sub env_exists { return exists $ENV{ $_[0] } }
-sub env_true { return ( env_exists( $_[0] ) and $ENV{ $_[0] } ) }
+sub env_true   { return ( env_exists( $_[0] ) and $ENV{ $_[0] } ) }
+sub env_is     { return ( env_exists( $_[0] ) and $ENV{ $_[0] } eq $_[1] ) }
 
-sub safe_exec {
+sub safe_exec_nonfatal {
   my ( $command, @params ) = @_;
   diag("running $command @params");
   my $exit = system( $command, @params );
@@ -16,23 +17,35 @@ sub safe_exec {
     my $high = $exit >> 8;
     warn "$command failed: $? $! and exit = $high , flags = $low";
     if ( $high != 0 ) {
-      exit $high;
+      return $high;
     }
     else {
-      exit 1;
+      return 1;
     }
   }
-  return 1;
+  return 0;
 }
 
-if ( -e './Build.PL' ) {
-  safe_exec( $^X, './Build.PL' );
-  safe_exec("./Build");
-  exit 0;
+sub safe_exec {
+  my ( $command, @params ) = @_;
+  my $result = safe_exec_nonfatal( $command, @params );
+  exit $result if $result != 0;
 }
-if ( -e './Makefile.PL' ) {
-  safe_exec( $^X, './Makefile.PL' );
-  safe_exec("make");
+
+if ( env_is( 'TRAVIS_BRANCH', 'master' ) ) {
+  diag("before_script skipped, TRAVIS_BRANCH=master");
   exit 0;
 }
+else {
+  if ( -e './Build.PL' ) {
+    safe_exec( $^X, './Build.PL' );
+    safe_exec("./Build");
+    exit 0;
+  }
+  if ( -e './Makefile.PL' ) {
+    safe_exec( $^X, './Makefile.PL' );
+    safe_exec("make");
+    exit 0;
+  }
+}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-role-bootstrap-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to