[Bps-public-commit] Shipwright branch, master, updated. 031f6797fabba973d61efd9280458613caf4dddf

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Sep 10 21:55:03 EDT 2009


The branch, master has been updated
       via  031f6797fabba973d61efd9280458613caf4dddf (commit)
      from  0a2e0379c7de898479c8e1876138fe852136b3c6 (commit)

Summary of changes:
 lib/Shipwright/Manual/ENV.pod |    6 ++++++
 lib/Shipwright/Source.pm      |    9 ++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 031f6797fabba973d61efd9280458613caf4dddf
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 11 09:54:07 2009 +0800

    add SHIPWRIGHT_SOURCE_ROOT env

diff --git a/lib/Shipwright/Manual/ENV.pod b/lib/Shipwright/Manual/ENV.pod
index a465303..70f6a73 100644
--- a/lib/Shipwright/Manual/ENV.pod
+++ b/lib/Shipwright/Manual/ENV.pod
@@ -18,6 +18,12 @@ user's home directory, e.g. /home/joe
 
     path of 'make' cmd, default value is 'make' on UNIX
 
+=item SHIPWRIGHT_SOURCE_ROOT
+
+    directory where shipwright keeps source data except downloads,
+    which will be in $ENV{SHIPWRIGHT_USER_ROOT}/downloads.
+    default value is a temp dir.
+
 =item SHIPWRIGHT_USER_ROOT
 
     directory where shipwright keeps internal data
diff --git a/lib/Shipwright/Source.pm b/lib/Shipwright/Source.pm
index 560816f..301fcf6 100644
--- a/lib/Shipwright/Source.pm
+++ b/lib/Shipwright/Source.pm
@@ -23,18 +23,21 @@ Shipwright::Source - Source
 
 =cut
 
+$ENV{SHIPWRIGHT_SOURCE_ROOT} ||=
+  tempdir( 'shipwright_source_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+
 sub new {
     my $class = shift;
     my %args = (
         follow => 1,
-        directory =>
-          tempdir( 'shipwright_source_XXXXXX', CLEANUP => 1, TMPDIR => 1 ),
+        directory => $ENV{SHIPWRIGHT_SOURCE_ROOT},
         @_,
     );
 
-    $args{scripts_directory} ||= catdir( $args{directory}, '__scripts' );
     $args{download_directory} ||=
       catdir( Shipwright::Util->shipwright_user_root, 'downloads' );
+
+    $args{scripts_directory} ||= catdir( $args{directory}, '__scripts' );
     $args{map_path}      ||= catfile( $args{directory}, 'map.yml' );
     $args{url_path}      ||= catfile( $args{directory}, 'url.yml' );
     $args{version_path}  ||= catfile( $args{directory}, 'version.yml' );

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



More information about the Bps-public-commit mailing list