[Bps-public-commit] r13374 - in Shipwright/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jun 17 19:13:07 EDT 2008


Author: sunnavy
Date: Tue Jun 17 19:13:07 2008
New Revision: 13374

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Test.pm

Log:
 r13520 at sunnavys-mb:  sunnavy | 2008-06-18 06:40:33 +0800
 added shipwright_bin and devel_cover_enalbed for Test.pm


Modified: Shipwright/trunk/lib/Shipwright/Test.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Test.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Test.pm	Tue Jun 17 19:13:07 2008
@@ -6,8 +6,10 @@
 
 use File::Temp qw/tempdir/;
 use IPC::Cmd qw/can_run/;
+use File::Spec;
 
-our @EXPORT_OK = qw/has_svk has_svn create_svk_repo create_svn_repo/;
+our @EXPORT_OK =
+  qw/has_svk has_svn create_svk_repo create_svn_repo devel_cover_enabled/;
 
 =head1 NAME
 
@@ -25,7 +27,7 @@
 =cut
 
 sub has_svk {
-   return can_run('svk') && can_run('svnadmin');
+    return can_run('svk') && can_run('svnadmin');
 }
 
 =head2 has_svn
@@ -36,7 +38,7 @@
 =cut
 
 sub has_svn {
-   return can_run('svn') && can_run('svnadmin');
+    return can_run('svn') && can_run('svnadmin');
 }
 
 =head2 create_svk_repo 
@@ -63,13 +65,10 @@
 
 sub create_svn_repo {
     my $repo = tempdir;
-    system("svnadmin create $repo" ) && die "create repo failed: $!";
+    system("svnadmin create $repo") && die "create repo failed: $!";
     return "file://$repo";
 }
 
-1;
-
-
 =head2 init
 
 init something, like log
@@ -81,6 +80,35 @@
     Shipwright::Logger->new( log_level => 'FATAL' );
 }
 
+=head2 shipwright_bin
+
+return the path of bin/shipwright
+
+=cut
+
+sub shipwright_bin {
+    no warnings 'uninitialized';
+
+    # so, we'd better add lib to PERL5LIB before run shipwright.
+    # what? you don't want to run shipwright?!!
+    # then what did you call this method for?
+
+    $ENV{PERL5LIB} = 'lib:' . $ENV{PERL5LIB} unless $ENV{PERL5LIB} =~ /^lib:/;
+    return File::Spec->catfile( 'bin', 'shipwright' );
+}
+
+=head2 devel_cover_enabled
+
+return true if -MDevel::Cover
+
+=cut
+
+sub devel_cover_enabled {
+    return $INC{'Devel/Cover.pm'};
+}
+
+1;
+
 __END__
 
 =head1 INTERFACE



More information about the Bps-public-commit mailing list