[Bps-public-commit] r10754 - Shipwright/lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Feb 7 02:50:00 EST 2008


Author: sunnavy
Date: Thu Feb  7 02:49:59 2008
New Revision: 10754

Modified:
   Shipwright/lib/Shipwright/Source/CPAN.pm

Log:
just warn if can't find dist on CPAN

Modified: Shipwright/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/lib/Shipwright/Source/CPAN.pm	Thu Feb  7 02:49:59 2008
@@ -26,23 +26,23 @@
     my $self  = $class->SUPER::new(@_);
     CPAN::Config->use or warn 'CPAN::Config not found';
 
-    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';
-        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';
+#        write_file( $config_file,
+#            Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
+#
+#    }
+#    require CPAN::MyConfig;
     return $self;
 }
 
@@ -53,9 +53,10 @@
 sub run {
     my $self = shift;
     $self->log->info("prepare to run source: " . $self->source );
-    $self->_run;
-    my $compressed = Shipwright::Source::Compressed->new(%$self);
-    $compressed->run(@_);
+    if ( $self->_run ) {
+        my $compressed = Shipwright::Source::Compressed->new(%$self);
+        $compressed->run(@_);
+    }
 }
 
 sub _run {
@@ -64,7 +65,12 @@
 
     my $module = CPAN::Shell->expand( 'Module', $self->source );
 
-    croak 'invalid module name: ' . $self->source unless $module;
+    unless ($module) {
+        $self->log->warn( "can't find "
+              . $self->source
+              . ' on CPAN, assuming you will manually fix it. good luck!' );
+        return;
+    }
 
     $module->distribution->get;
 
@@ -84,6 +90,7 @@
             'id',                               $module->cpan_file
         )
     );
+    return 1;
 }
 
 1;



More information about the Bps-public-commit mailing list