Updated makefile
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Build.pm
CommitLineData
10d487cb 1package Catalyst::Build;
2
3use strict;
4use Module::Build;
5use base 'Module::Build';
6use Path::Class;
7use File::Find 'find';
8
9our @ignore =
10 qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README
11 _build blib lib script t/;
12
13our $FAKE;
14our $ignore = '^(' . join( '|', @ignore ) . ')$';
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 DEPRECATION NOTICE
29
30This module is deprecated in favor of L<Module::Install::Catalyst>.
31
32=head1 METHODS
33
34=over 4
35
36=item ACTION_install
37
38=cut
39
40sub new {
41 my $class = shift;
42 my $self = $class->SUPER::new(@_);
43
44 my $app_name = $self->{properties}{module_name};
45 warn <<"EOF";
46
47 Note:
48
49 The use of Build.PL for building and distributing Catalyst
50 applications is deprecated in Catalyst 5.58.
51
52 We recommend using the new Module::Install-based Makefile
53 system. You can generate a new Makefile.PL for your application
54 by running:
55
56 catalyst.pl -force -makefile $app_name
57
58EOF
59
60 return $self;
61}
62
63sub ACTION_install {
64 my $self = shift;
65 $self->SUPER::ACTION_install;
66 $self->ACTION_install_extras;
67}
68
69=item ACTION_fakeinstall
70
71=cut
72
73sub ACTION_fakeinstall {
74 my $self = shift;
75 $self->SUPER::ACTION_fakeinstall;
76 local $FAKE = 1;
77 $self->ACTION_install_extras;
78}
79
80=item ACTION_install_extras
81
82=cut
83
84sub ACTION_install_extras {
85 my $self = shift;
86 my $prefix = $self->{properties}{destdir} || undef;
87 my $sitelib = $self->install_destination('lib');
88 my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib);
89 my $path = dir( @path, split( '::', $self->{properties}{module_name} ) );
90 my @files = $self->_find_extras;
91 print "Installing extras to $path\n";
92 for (@files) {
93 $FAKE
94 ? print "$_ -> $path (FAKE)\n"
95 : $self->copy_if_modified( $_, $path );
96 }
97}
98
99sub _find_extras {
100 my $self = shift;
101 my @all = glob '*';
102 my @files;
103 for my $file (@all) {
104 next if $file =~ /$ignore/;
105 if ( -d $file ) {
106 find(
107 sub {
108 return if -d;
109 push @files, $File::Find::name;
110 },
111 $file
112 );
113 }
114 else { push @files, $file }
115 }
116 return @files;
117}
118
119=back
120
121=head1 AUTHOR
122
123Sebastian Riedel, C<sri@oook.de>
124
125=head1 LICENSE
126
127This library is free software, you can redistribute it and/or modify it under
128the same terms as Perl itself.
129
130=cut
131
1321;