Renamed tests
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Build.pm
CommitLineData
4f6748f1 1package Catalyst::Build;
2
3use strict;
4use Module::Build;
5use base 'Module::Build';
6use Path::Class;
7use File::Find 'find';
8
b94ad1f4 9our @ignore =
10 qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README
11 _build blib lib script t/;
12
4f6748f1 13our $FAKE;
b94ad1f4 14our $ignore = '^(' . join( '|', @ignore ) . ')$';
4f6748f1 15
16=head1 NAME
17
18Catalyst::Build - Module::Build extension for Catalyst
19
20=head1 SYNOPSIS
21
22See L<Catalyst>
23
24=head1 DESCRIPTION
25
26L<Module::Build> extension for Catalyst.
27
28=head1 METHODS
29
b5ecfcf0 30=head2 ACTION_install
4f6748f1 31
32=cut
33
34sub ACTION_install {
35 my $self = shift;
36 $self->SUPER::ACTION_install;
37 $self->ACTION_install_extras;
38}
39
b5ecfcf0 40=head2 ACTION_fakeinstall
4f6748f1 41
42=cut
43
44sub ACTION_fakeinstall {
45 my $self = shift;
46 $self->SUPER::ACTION_fakeinstall;
47 local $FAKE = 1;
48 $self->ACTION_install_extras;
49}
50
b5ecfcf0 51=head2 ACTION_install_extras
4f6748f1 52
53=cut
54
55sub ACTION_install_extras {
91eeb37b 56 my $self = shift;
57 my $prefix = $self->{properties}{destdir} || undef;
9cee9588 58 my $sitelib = $self->install_destination('lib');
91eeb37b 59 my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib);
60 my $path = dir( @path, split( '::', $self->{properties}{module_name} ) );
61 my @files = $self->_find_extras;
4f6748f1 62 print "Installing extras to $path\n";
63 for (@files) {
64 $FAKE
750b3d4c 65 ? print "$_ -> $path (FAKE)\n"
4f6748f1 66 : $self->copy_if_modified( $_, $path );
67 }
68}
69
70sub _find_extras {
71 my $self = shift;
72 my @all = glob '*';
73 my @files;
74 for my $file (@all) {
75 next if $file =~ /$ignore/;
76 if ( -d $file ) {
77 find(
78 sub {
79 return if -d;
80 push @files, $File::Find::name;
81 },
82 $file
83 );
84 }
85 else { push @files, $file }
86 }
87 return @files;
88}
89
4f6748f1 90=head1 AUTHOR
91
92Sebastian Riedel, C<sri@oook.de>
93
94=head1 LICENSE
95
41ca9ba7 96This library is free software, you can redistribute it and/or modify it under
97the same terms as Perl itself.
4f6748f1 98
99=cut
100
1011;