[Bps-public-commit] r9950 - bpsbuilder/BPB/lib/BPB/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Dec 14 08:44:17 EST 2007


Author: sunnavy
Date: Fri Dec 14 08:44:17 2007
New Revision: 9950

Modified:
   bpsbuilder/BPB/lib/BPB/Source/Base.pm

Log:
added skip module support

Modified: bpsbuilder/BPB/lib/BPB/Source/Base.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Base.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Source/Base.pm	Fri Dec 14 08:44:17 2007
@@ -10,7 +10,8 @@
 
 use base qw/Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(
-    qw/source directory download_directory follow min_perl_version map_path/);
+    qw/source directory download_directory follow min_perl_version map_path skip/
+);
 
 =head2 new
 
@@ -47,7 +48,7 @@
     my $map          = {};
 
     if ( -e $self->map_path ) {
-        $map = BPB::Config::LoadFile($self->map_path);
+        $map = BPB::Config::LoadFile( $self->map_path );
     }
 
     # if not found, we'll create one according to META.yml
@@ -72,19 +73,24 @@
                 $self->min_perl_version )
             {
                 delete $require->{$module};
+                next;
+            }
+
+            if ( $self->_is_skipped($module) ) {
+                delete $require->{$module};
+                next;
             }
-            else {
-                opendir my $dir, $self->directory;
-                my @sources = readdir $dir;
-                close $dir;
-
-                my $name = $map->{$module} || $module;
-                $name =~ s/::/-/g;
-
-                unless ( grep { /^$name/ } @sources ) {
-                    my $cpan = BPB::Source->new( %$self, source => $module );
-                    $cpan->run();
-                }
+
+            opendir my $dir, $self->directory;
+            my @sources = readdir $dir;
+            close $dir;
+
+            my $name = $map->{$module} || $module;
+            $name =~ s/::/-/g;
+
+            unless ( grep { /^$name/ } @sources ) {
+                my $cpan = BPB::Source->new( %$self, source => $module );
+                $cpan->run();
             }
         }
 
@@ -112,6 +118,18 @@
 
 }
 
+sub _is_skipped {
+    my $self   = shift;
+    my $module = shift;
+
+    for ( @{ $self->skip } ) {
+        return 1 if $module =~ /$_/;
+    }
+
+    return;
+
+}
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list