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

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


Author: sunnavy
Date: Mon Jun 16 17:42:04 2008
New Revision: 13338

Added:
   Shipwright/trunk/t/06.logger.t
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
   Shipwright/trunk/t/00.load.t
   Shipwright/trunk/t/05.util.t

Log:
 r13467 at sunnavys-mb:  sunnavy | 2008-06-17 05:36:21 +0800
 added 06.logger.t


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:04 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/);
+    qw/repository log_level name all follow log_file builder utility build/);
 
 use Shipwright;
 use File::Spec;
@@ -28,6 +28,7 @@
         'follow'         => 'follow',
         'builder'        => 'builder',
         'utility'        => 'utility',
+        'build'          => 'build',
     );
 }
 
@@ -43,6 +44,9 @@
         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' ) );
@@ -54,10 +58,6 @@
     }
     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->{ $self->name } && $map->{ $self->name } ) {
+            if ( !$source->{$name} && $map->{$name} ) {
 
                 # in case the name is module name
-                $self->name( $map->{ $self->name } );
+                $name = $map->{$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:04 2008
@@ -61,7 +61,11 @@
     my $source = shift;
 
     # prefix that can't be omitted
-    return 'Compressed' if $$source =~ s/^file:.*(tar\.gz|tar\.bz2|tgz)$//i;
+    if ( $$source =~ /^file:.*\.(tar\.gz|tgz|tar\.bz2)$/ ) {
+        $$source =~ s/^file://i;
+        return 'Compressed';
+    }
+
     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:04 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;
 }
 

Modified: Shipwright/trunk/t/00.load.t
==============================================================================
--- Shipwright/trunk/t/00.load.t	(original)
+++ Shipwright/trunk/t/00.load.t	Mon Jun 16 17:42:04 2008
@@ -3,7 +3,6 @@
 use File::Basename qw( dirname );
 
 my $manifest = File::Spec->catdir( dirname(__FILE__), '..', 'MANIFEST' );
-diag("Testing Shipwright $Shipwright::VERSION");
 plan skip_all => 'MANIFEST does not exist' unless -e $manifest;
 open FH, '<', $manifest;
 

Modified: Shipwright/trunk/t/05.util.t
==============================================================================
--- Shipwright/trunk/t/05.util.t	(original)
+++ Shipwright/trunk/t/05.util.t	Mon Jun 16 17:42:04 2008
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 15;
+use Test::More tests => 16;
 
 use Shipwright::Test;
 use Shipwright::Util;

Added: Shipwright/trunk/t/06.logger.t
==============================================================================
--- (empty file)
+++ Shipwright/trunk/t/06.logger.t	Mon Jun 16 17:42:04 2008
@@ -0,0 +1,12 @@
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+require Shipwright::Logger;
+Shipwright::Logger->new( { log_level => undef } ) ;
+
+ok( Log::Log4perl->initialized, 'initialized' );
+my $logger = Log::Log4perl->get_logger;
+ok( $logger->is_fatal, 'default level is fatal' );
+



More information about the Bps-public-commit mailing list