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