Fixed typo
[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
9our $FAKE;
10our $ignore = '^('
11 . join( '|',
12 qw/Build Build.PL Changes Makefile.PL README _build blib lib script t/ )
13 . ')$';
14
15=head1 NAME
16
17Catalyst::Build - Module::Build extension for Catalyst
18
19=head1 SYNOPSIS
20
21See L<Catalyst>
22
23=head1 DESCRIPTION
24
25L<Module::Build> extension for Catalyst.
26
27=head1 METHODS
28
29=item ACTION_install
30
31=cut
32
33sub ACTION_install {
34 my $self = shift;
35 $self->SUPER::ACTION_install;
36 $self->ACTION_install_extras;
37}
38
39=item ACTION_fakeinstall
40
41=cut
42
43sub ACTION_fakeinstall {
44 my $self = shift;
45 $self->SUPER::ACTION_fakeinstall;
46 local $FAKE = 1;
47 $self->ACTION_install_extras;
48}
49
50=item ACTION_install_extras
51
52=cut
53
54sub ACTION_install_extras {
55 my $self = shift;
56 my $prefix = $self->{properties}{destdir} || '';
57 my $path = dir(
58 $prefix,
59 $self->{config}{installsitelib},
60 split( '::', $self->{properties}{module_name} )
61 );
62 my @files = $self->_find_extras;
63 print "Installing extras to $path\n";
64 for (@files) {
65 $FAKE
66 ? print "$_ -> $path/$_ (FAKE)\n"
67 : $self->copy_if_modified( $_, $path );
68 }
69}
70
71sub _find_extras {
72 my $self = shift;
73 my @all = glob '*';
74 my @files;
75 for my $file (@all) {
76 next if $file =~ /$ignore/;
77 if ( -d $file ) {
78 find(
79 sub {
80 return if -d;
81 push @files, $File::Find::name;
82 },
83 $file
84 );
85 }
86 else { push @files, $file }
87 }
88 return @files;
89}
90
91=back
92
93=head1 AUTHOR
94
95Sebastian Riedel, C<sri@oook.de>
96
97=head1 LICENSE
98
99This library is free software . You can redistribute it and/or modify it under
100the same terms as perl itself.
101
102=cut
103
1041;