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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Aug 27 00:08:15 EDT 2008


Author: sunnavy
Date: Wed Aug 27 00:08:12 2008
New Revision: 15501

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/META.yml
   Shipwright/trunk/Makefile.PL
   Shipwright/trunk/lib/Shipwright/Util.pm

Log:
 r16113 at sunnavys-mb:  sunnavy | 2008-08-27 11:38:58 +0800
 improve Shipwright::Util->share_root, not use File::ShareDir anymore


Modified: Shipwright/trunk/META.yml
==============================================================================
--- Shipwright/trunk/META.yml	(original)
+++ Shipwright/trunk/META.yml	Wed Aug 27 00:08:12 2008
@@ -28,7 +28,6 @@
   Class::Accessor::Fast: 0
   File::Copy: 0
   File::Copy::Recursive: 0
-  File::ShareDir: 0
   File::Slurp: 0
   File::Spec: 0
   File::Temp: 0

Modified: Shipwright/trunk/Makefile.PL
==============================================================================
--- Shipwright/trunk/Makefile.PL	(original)
+++ Shipwright/trunk/Makefile.PL	Wed Aug 27 00:08:12 2008
@@ -16,7 +16,6 @@
 requires 'File::Temp' => 0;
 requires 'File::Copy' => 0;
 requires 'File::Copy::Recursive' => 0;
-requires 'File::ShareDir' => 0;
 requires 'File::Spec' => 0;
 requires 'File::Slurp' => 0;
 requires 'Hash::Merge' => 0;

Modified: Shipwright/trunk/lib/Shipwright/Util.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Util.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Util.pm	Wed Aug 27 00:08:12 2008
@@ -110,25 +110,19 @@
 sub share_root {
     my $self = shift;
 
-    require File::ShareDir;
-    $SHARE_ROOT ||=
-      eval { abs_path( File::ShareDir::module_dir('Shipwright') ) };
-
     unless ($SHARE_ROOT) {
-
-        # XXX TODO: This is a bloody hack
-        # Module::Install::Share and File::ShareDir don't play nicely
-        # together
         my @root = splitdir( $self->shipwright_root );
-        $root[-1] = 'share';           # replace 'lib' to 'share'
-        $SHARE_ROOT = catdir(@root);
-    }
 
-    if (   $SHARE_ROOT !~ m{([/\\])auto\1share\1}
-        && $SHARE_ROOT =~ m{([/\\])blib\1lib\1} )
-    {
-        my $sep = $1;
-        $SHARE_ROOT =~ s!${sep}auto$sep!${sep}auto${sep}share${sep}dist${sep}!;
+        if ( $root[-2] ne 'blib' && $root[-1] eq 'lib' ) {
+
+            # so it's -Ilib in the Shipwright's source dir
+            $root[-1] = 'share';
+        }
+        else {
+            push @root, qw/auto share dist Shipwright/;
+        }
+
+        $SHARE_ROOT = catdir(@root);
     }
 
     return ($SHARE_ROOT);



More information about the Bps-public-commit mailing list