Fixed preserve component order for instantiation
[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 {
58 my $self = shift;
59 my $prefix = $self->{properties}{destdir} || '';
60 my $path = dir(
61 $prefix,
62 $self->{config}{installsitelib},
63 split( '::', $self->{properties}{module_name} )
64 );
65 my @files = $self->_find_extras;
66 print "Installing extras to $path\n";
67 for (@files) {
68 $FAKE
69 ? print "$_ -> $path/$_ (FAKE)\n"
70 : $self->copy_if_modified( $_, $path );
71 }
72}
73
74sub _find_extras {
75 my $self = shift;
76 my @all = glob '*';
77 my @files;
78 for my $file (@all) {
79 next if $file =~ /$ignore/;
80 if ( -d $file ) {
81 find(
82 sub {
83 return if -d;
84 push @files, $File::Find::name;
85 },
86 $file
87 );
88 }
89 else { push @files, $file }
90 }
91 return @files;
92}
93
94=back
95
96=head1 AUTHOR
97
98Sebastian Riedel, C<sri@oook.de>
99
100=head1 LICENSE
101
102This library is free software . You can redistribute it and/or modify it under
103the same terms as perl itself.
104
105=cut
106
1071;