| 1 | #------------------------------------------------------------------------------- | ||
| 2 | # $URL$ | ||
| 3 | # $Date$ | ||
| 4 | # $Author$ | ||
| 5 | # $Revision$ | ||
| 6 | #------------------------------------------------------------------------------- | ||
| 7 | package Wetware::Test::Class::Load; | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | use Test::Class; | ||
| 13 | use File::Find; | ||
| 14 | use File::Spec; | ||
| 15 | |||
| 16 | use Test::Class::Load qw(); | ||
| 17 | |||
| 18 | |||
| 19 | sub import { | ||
| 20 | my ( $class, @directories ) = @_; | ||
| 21 | |||
| 22 | # this will filter out the CVS and .svn directories | ||
| 23 | my $preprocess = sub { | ||
| 24 | my (@dirs_found) = @_; | ||
| 25 | my @dirs_to_use = grep { | ||
| 26 | $_ ne 'CVS' && $_ ne '.svn' | ||
| 27 | } @dirs_found; | ||
| 28 | return @dirs_to_use; | ||
| 29 | }; | ||
| 30 | |||
| 31 | foreach my $dir ( @directories ) { | ||
| 32 | $dir = File::Spec->catdir( split '/', $dir ); | ||
| 33 | find( | ||
| 34 | { no_chdir => 1, | ||
| 35 | wanted => sub { Test::Class::Load::_load( $File::Find::name, $dir ) }, | ||
| 36 | 'preprocess' => $preprocess | ||
| 37 | }, | ||
| 38 | $dir | ||
| 39 | ); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | 1; | ||
| 45 | |||
| 46 | __END__ |