[Bps-public-commit] r13339 - in Shipwright/trunk: . lib/Shipwright/Script lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jun 16 17:42:31 EDT 2008


Author: sunnavy
Date: Mon Jun 16 17:42:30 2008
New Revision: 13339

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Script/Update.pm
   Shipwright/trunk/lib/Shipwright/Source.pm
   Shipwright/trunk/lib/Shipwright/Source/CPAN.pm

Log:
 r13468 at sunnavys-mb:  sunnavy | 2008-06-17 05:39:06 +0800
 revert back


Modified: Shipwright/trunk/lib/Shipwright/Script/Update.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Update.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Update.pm	Mon Jun 16 17:42:30 2008
@@ -6,7 +6,7 @@
 
 use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
 __PACKAGE__->mk_accessors(
-    qw/repository log_level name all follow log_file builder utility build/);
+    qw/repository log_level name all follow log_file builder utility/);
 
 use Shipwright;
 use File::Spec;
@@ -28,7 +28,6 @@
         'follow'         => 'follow',
         'builder'        => 'builder',
         'utility'        => 'utility',
-        'build'          => 'build',
     );
 }
 
@@ -44,9 +43,6 @@
         log_file   => $self->log_file,
     );
 
-    $self->name($name) if $name && !$self->name;
-    $name = $self->name;
-
     if ( $self->builder ) {
         $shipwright->backend->update(
             path => File::Spec->catfile( 'bin', 'shipwright-builder' ) );
@@ -58,6 +54,10 @@
     }
     else {
 
+        $self->name($name) if $name && !$self->name;
+
+        die 'need name arg' unless $self->name || $self->all;
+
         $map    = $shipwright->backend->map    || {};
         $source = $shipwright->backend->source || {};
 
@@ -68,10 +68,10 @@
             }
         }
         else {
-            if ( !$source->{$name} && $map->{$name} ) {
+            if ( !$source->{ $self->name } && $map->{ $self->name } ) {
 
                 # in case the name is module name
-                $name = $map->{$name};
+                $self->name( $map->{ $self->name } );
             }
 
             my @dists;

Modified: Shipwright/trunk/lib/Shipwright/Source.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source.pm	Mon Jun 16 17:42:30 2008
@@ -61,11 +61,7 @@
     my $source = shift;
 
     # prefix that can't be omitted
-    if ( $$source =~ /^file:.*\.(tar\.gz|tgz|tar\.bz2)$/ ) {
-        $$source =~ s/^file://i;
-        return 'Compressed';
-    }
-
+    return 'Compressed' if $$source =~ s/^file:.*(tar\.gz|tar\.bz2|tgz)$//i;
     return 'Directory'  if $$source =~ s/^dir(ectory)?://i;
 
     if ( $$source =~ s/^cpan://i ) {

Modified: Shipwright/trunk/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	Mon Jun 16 17:42:30 2008
@@ -28,24 +28,24 @@
 
     CPAN::Config->use;
 
-#    mkdir File::Spec->catfile( $cpan_dir, 'CPAN' );
-#    my $config_file = File::Spec->catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
-#
-#    unless ( -f $config_file ) {
-#        $CPAN::Config->{cpan_home} = File::Spec->catfile($cpan_dir);
-#        $CPAN::Config->{build_dir} = File::Spec->catfile( $cpan_dir, 'build' );
-#        $CPAN::Config->{histfile} =
-#          File::Spec->catfile( $cpan_dir, 'histfile' );
-#        $CPAN::Config->{keep_source_where} =
-#          File::Spec->catfile( $cpan_dir, 'sources' );
-#        $CPAN::Config->{prefs_dir} = File::Spec->catfile( $cpan_dir, 'prefs' );
-#        $CPAN::Config->{prerequisites_policy} = 'follow';
-#        $CPAN::Config->{urllist}              = [];
-#        write_file( $config_file,
-#            Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
-#
-#    }
-#    require CPAN::MyConfig;
+    mkdir File::Spec->catfile( $cpan_dir, 'CPAN' );
+    my $config_file = File::Spec->catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
+
+    unless ( -f $config_file ) {
+        $CPAN::Config->{cpan_home} = File::Spec->catfile($cpan_dir);
+        $CPAN::Config->{build_dir} = File::Spec->catfile( $cpan_dir, 'build' );
+        $CPAN::Config->{histfile} =
+          File::Spec->catfile( $cpan_dir, 'histfile' );
+        $CPAN::Config->{keep_source_where} =
+          File::Spec->catfile( $cpan_dir, 'sources' );
+        $CPAN::Config->{prefs_dir} = File::Spec->catfile( $cpan_dir, 'prefs' );
+        $CPAN::Config->{prerequisites_policy} = 'follow';
+        $CPAN::Config->{urllist}              = [];
+        write_file( $config_file,
+            Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
+
+    }
+    require CPAN::MyConfig;
     return $self;
 }
 



More information about the Bps-public-commit mailing list