Codebase list libmodule-build-tiny-perl / 2b4c589
Remove dependency on File::Find::Rule Leon Timmermans 11 years ago
2 changed file(s) with 13 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Module::Build::Tiny
11
22 {{$NEXT}}
3 Remove dependency on File::Find::Rule
34
45 0.014 2013-04-04 15:58:50 Europe/Amsterdam
56 Added sharedir support
1010 use ExtUtils::Install qw/pm_to_blib install/;
1111 use ExtUtils::InstallPaths 0.002;
1212 use File::Basename qw/dirname/;
13 use File::Find::Rule qw/find/;
1413 use File::HomeDir;
1514 use File::Path qw/mkpath/;
1615 use File::Spec::Functions qw/catfile catdir rel2abs abs2rel/;
4847 return;
4948 }
5049
50 sub find {
51 my ($pattern, @dirs) = @_;
52 my @ret;
53 File::Find::find(sub { push @ret, $File::Find::name if -f $_ && $_ =~ $pattern }, @dirs);
54 return @ret;
55 }
56
5157 my %actions = (
5258 build => sub {
5359 my %opt = @_;
54 system $^X, $_ and die "$_ returned $?\n" for find(file => name => '*.PL', in => 'lib');
55 my %modules = map { $_ => catfile('blib', $_) } find(file => name => [qw/*.pm *.pod/], in => 'lib');
56 my %scripts = map { $_ => catfile('blib', $_) } find(file => name => '*', in => 'script');
57 my %shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(file => name => '*', in => 'share');
60 system $^X, $_ and die "$_ returned $?\n" for find(qr/\.PL$/, 'lib');
61 my %modules = map { $_ => catfile('blib', $_) } find(qr/\.p(?:m|od)$/, 'lib');
62 my %scripts = map { $_ => catfile('blib', $_) } find(qr//, 'script');
63 my %shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr//, 'share');
5864 pm_to_blib({ %modules, %scripts, %shared }, catdir(qw/blib lib auto/));
5965 make_executable($_) for values %scripts;
6066 mkpath(catdir(qw/blib arch/), $opt{verbose});
6874 my %opt = @_;
6975 die "Must run `./Build build` first\n" if not -d 'blib';
7076 my $tester = TAP::Harness->new({verbosity => $opt{verbose}, lib => rel2abs(catdir(qw/blib lib/)), color => -t STDOUT});
71 $tester->runtests(sort +find(file => name => '*.t', in => 't'))->has_errors and exit 1;
77 $tester->runtests(sort +find(qr/\.t$/, 't'))->has_errors and exit 1;
7278 },
7379 install => sub {
7480 my %opt = @_;