Fixed pod and added Catalyst::Utils::appprefix
[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
1bd12246 30=over 4
75aeff23 31
4f6748f1 32=item ACTION_install
33
34=cut
35
36sub ACTION_install {
37 my $self = shift;
38 $self->SUPER::ACTION_install;
39 $self->ACTION_install_extras;
40}
41
42=item ACTION_fakeinstall
43
44=cut
45
46sub ACTION_fakeinstall {
47 my $self = shift;
48 $self->SUPER::ACTION_fakeinstall;
49 local $FAKE = 1;
50 $self->ACTION_install_extras;
51}
52
53=item ACTION_install_extras
54
55=cut
56
57sub ACTION_install_extras {
91eeb37b 58 my $self = shift;
59 my $prefix = $self->{properties}{destdir} || undef;
9cee9588 60 my $sitelib = $self->install_destination('lib');
91eeb37b 61 my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib);
62 my $path = dir( @path, split( '::', $self->{properties}{module_name} ) );
63 my @files = $self->_find_extras;
4f6748f1 64 print "Installing extras to $path\n";
65 for (@files) {
66 $FAKE
750b3d4c 67 ? print "$_ -> $path (FAKE)\n"
4f6748f1 68 : $self->copy_if_modified( $_, $path );
69 }
70}
71
72sub _find_extras {
73 my $self = shift;
74 my @all = glob '*';
75 my @files;
76 for my $file (@all) {
77 next if $file =~ /$ignore/;
78 if ( -d $file ) {
79 find(
80 sub {
81 return if -d;
82 push @files, $File::Find::name;
83 },
84 $file
85 );
86 }
87 else { push @files, $file }
88 }
89 return @files;
90}
91
92=back
93
94=head1 AUTHOR
95
96Sebastian Riedel, C<sri@oook.de>
97
98=head1 LICENSE
99
41ca9ba7 100This library is free software, you can redistribute it and/or modify it under
101the same terms as Perl itself.
4f6748f1 102
103=cut
104
1051;