[Bps-public-commit] r12327 - in Shipwright/trunk: lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu May 15 06:03:22 EDT 2008


Author: sunnavy
Date: Thu May 15 06:03:21 2008
New Revision: 12327

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

Log:
 r12366 at sunnavys-mb:  sunnavy | 2008-05-15 16:25:50 +0800
 we can skip source option when import if that dist was imported before and we don't wanna change source


Modified: Shipwright/trunk/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Import.pm	Thu May 15 06:03:21 2008
@@ -49,6 +49,28 @@
     my $source = shift;
 
     $self->source($source) if $source && !$self->source;
+
+    if ( $self->name && !$self->source ) {
+
+        # don't have source specified, use the one in repo
+        my $shipwright = Shipwright->new(
+            repository => $self->repository,
+            log_level  => $self->log_level,
+            log_file   => $self->log_file,
+        );
+        my $map    = $shipwright->backend->map    || {};
+        my $source = $shipwright->backend->source || {};
+
+        my $r_map = { reverse %$map };
+        if ( $r_map->{ $self->name } ) {
+            $self->source( 'cpan:' . $r_map->{ $self->name } );
+        }
+        elsif ( $source->{ $self->name } ) {
+            $self->source( $source->{ $self->name } );
+        }
+
+    }
+
     $self->follow(1) unless defined $self->follow;
     $self->skip( { map { $_ => 1 } split /\s*,\s*/, $self->skip || '' } );
 
@@ -295,7 +317,7 @@
 # _parent_dir: return parent dir
 
 sub _parent_dir {
-    my $self = shift;
+    my $self   = shift;
     my $source = shift;
     my @dirs   = File::Spec->splitdir($source);
     pop @dirs;
@@ -307,7 +329,7 @@
 # move ExtUtils::MakeMaker and Module::Build to the head of cpan dists
 
 sub _reorder {
-    my $self = shift;
+    my $self       = shift;
     my $shipwright = shift;
     my $order      = $shipwright->backend->order;
 



More information about the Bps-public-commit mailing list