Fix author requires to not fatally error on a single command
[catagits/Catalyst-Runtime.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install 1.06;
4 # Ensure that these get used - yes, M::I loads them for us, but if you're
5 # in author mode and don't have them installed, then the error is tres
6 # cryptic.
7 use Module::Install::CheckConflicts;
8 use Module::Install::Authority;
9
10 # (Stolen from DBIC)
11 # nasty hook into both M::AI init and the prompter, so that the optdep message
12 # comes at the right places (on top and then right above the prompt)
13 my $optdep_msg = '';
14 {
15   require Module::AutoInstall;
16   no warnings 'redefine';
17   no strict 'refs';
18
19   for (qw/_prompt import/) {
20     my $meth = "Module::AutoInstall::$_";
21     my $orig = \&{$meth};
22     *{$meth} = sub {
23       print $optdep_msg;
24       goto $orig;
25     };
26   }
27 }
28
29 perl_version '5.008003';
30
31 name 'Catalyst-Runtime';
32 author 'Sebastian Riedel <sri@cpan.org>';
33 authority 'MSTROUT';
34 all_from 'lib/Catalyst/Runtime.pm';
35
36 requires 'List::MoreUtils';
37 requires 'namespace::autoclean' => '0.09';
38 requires 'namespace::clean' => '0.13';
39 requires 'B::Hooks::EndOfScope' => '0.10';
40 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
41 requires 'Class::Load' => '0.12';
42 requires 'Class::MOP' => '0.95';
43 requires 'Data::OptList';
44 requires 'Moose' => '1.03';
45 requires 'MooseX::MethodAttributes::Inheritable' => '0.24';
46 requires 'MooseX::Role::WithOverloading' => '0.09';
47 requires 'MooseX::Types::LoadableClass' => '0.003';
48 requires 'Carp';
49 requires 'Class::C3::Adopt::NEXT' => '0.07';
50 requires 'CGI::Simple::Cookie' => '1.109';
51 requires 'Data::Dump';
52 requires 'Data::OptList';
53 requires 'HTML::Entities';
54 requires 'HTML::HeadParser';
55 requires 'HTTP::Body'    => '1.06'; # ->cleanup(1)
56 requires 'HTTP::Headers' => '1.64';
57 requires 'HTTP::Request' => '5.814';
58 requires 'HTTP::Response' => '5.813';
59 requires 'HTTP::Request::AsCGI' => '1.0';
60 requires 'LWP::UserAgent';
61 requires 'Module::Pluggable' => '3.9';
62 requires 'Path::Class' => '0.09';
63 requires 'Scalar::Util';
64 requires 'Sub::Exporter';
65 requires 'Text::SimpleTable' => '0.03';
66 requires 'Time::HiRes';
67 requires 'Tree::Simple' => '1.15';
68 requires 'Tree::Simple::Visitor::FindByPath';
69 requires 'Try::Tiny';
70 requires 'URI' => '1.35';
71 requires 'Task::Weaken';
72 requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
73 requires 'MRO::Compat';
74 requires 'MooseX::Getopt' => '0.30';
75 requires 'MooseX::Types';
76 requires 'MooseX::Types::Common::Numeric';
77 requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
78 requires 'Plack' => '0.9974'; # IIS6 fix middleware
79 requires 'Plack::Middleware::ReverseProxy' => '0.04';
80 requires 'Plack::Test::ExternalServer';
81
82 test_requires 'Class::Data::Inheritable';
83 test_requires 'Test::Exception';
84 test_requires 'Test::More' => '0.88';
85 test_requires 'Data::Dump';
86 test_requires 'HTTP::Request::Common';
87
88 # No fatal author_* BS!  This is the sole AUTHOR block
89 if ($Module::Install::AUTHOR) {
90     $optdep_msg .= <<'EOW';
91
92 ******************************************************************************
93 ******************************************************************************
94 ***                                                                        ***
95 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
96 ***                                                                        ***
97 ******************************************************************************
98 ******************************************************************************
99
100 EOW
101     # This is now default to on unless it is explicitly set to zero
102     #my $aggregate_tests = exists $ENV{AGGREGATE_TESTS} ? $ENV{AGGREGATE_TESTS} : 1;
103
104     #### This is NOT default until Test::Aggregate fixes their Test::Builder monkey patching!
105     #### Remove this code and uncomment the above when it's fixed!
106     my $aggregate_tests = $ENV{AGGREGATE_TESTS};
107
108     # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
109     if ($aggregate_tests && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.364')) {
110         test_requires('Test::Aggregate', '0.364');
111         test_requires('Test::Simple', '0.88');
112         open my $fh, '>', '.aggregating';
113     }
114     else {
115         if ($aggregate_tests) {
116             # Friendly Reminder...
117             # There's no such thing as test_recommends (which wouldn't even end
118             # up on the module list, anyway), so we just print.
119             $optdep_msg .= <<'EOW';
120 ******************************************************************************
121 * Author-level aggregate testing can go a lot smoother with Test::Aggregate  *
122 * and Test::Simple installed.  Resorting to old-style multi-processed tests. *
123 *                                                                            *
124 * (This notice can be silenced by explicitly setting AGGREGATE_TESTS=0.)     *
125 ******************************************************************************
126 EOW
127             #recommends('Test::Aggregate', '0.364');
128             #recommends('Test::Simple', '0.88');
129         }
130         unlink '.aggregating';
131         tests 't/*.t t/aggregate/*.t';
132     }
133  
134     test_requires 'CatalystX::LeakChecker', '0.05';
135     test_requires 'File::Copy::Recursive'; # For http server test
136     test_requires 'Catalyst::Devel', '1.0'; # For http server test
137     test_requires 'Catalyst::Engine::PSGI';
138     test_requires 'Test::Without::Module';
139     unless ($^O eq 'MSWin32') {
140         test_requires 'Starman';
141         test_requires 'MooseX::Daemonize';
142     }
143     
144     tests ('t/*.t t/author/*.t');
145     test_requires(map {; $_ => 0 } qw(
146         Test::NoTabs
147         Test::Pod
148         Test::Pod::Coverage
149         Test::Spelling
150         Pod::Coverage::TrustPod
151     ));
152
153     darwin_check_no_resource_forks();
154 }
155
156 resources(
157     'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst',
158     'IRC'         => 'irc://irc.perl.org/#catalyst',
159     'license',    => 'http://dev.perl.org/licenses/',
160     'homepage',   => 'http://dev.catalyst.perl.org/',
161     'repository', => 'git://git.shadowcat.co.uk/catagits/Catalyst-Runtime.git',
162 );
163
164 install_script glob('script/*.pl');
165 auto_install;
166 WriteAll;
167
168 print <<"EOF";
169
170  Important:
171
172     This library is for running Catalyst applications.
173
174     For development and use of catalyst.pl and myapp_create.pl, make sure
175     you also install the development tools package Catalyst::Devel.
176
177         perl -MCPANPLUS -e 'install Catalyst::Devel' # or
178         perl -MCPAN -e 'install Catalyst::Devel'     # or
179         cpanm Catalyst::Devel
180
181     To get some commonly used plugins, as well as the TT view and DBIC
182     model, install Task::Catalyst in the same way.
183
184  Have fun!
185 EOF
186
187 # NOTE - This is the version number of the _incompatible_ code,
188 #        not the version number of the fixed version.
189 my %conflicts = (
190     'Catalyst::Plugin::SubRequest' => '0.14',
191     'Catalyst::Model::Akismet' => '0.02',
192     'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
193     'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
194                                        # should have been a core fix.
195     'Catalyst::Plugin::Unicode::Encoding' => '0.2',
196     'Catalyst::Plugin::Authentication' => '0.10010', # _config accessor in ::Credential::Password
197     'Catalyst::Authentication::Credential::HTTP' => '1.009',
198     'Catalyst::Plugin::Session::Store::File'     => '0.16',
199     'Catalyst::Plugin::Session'                  => '0.21',
200     'Catalyst::Plugin::Session::State::Cookie'   => '0.10',
201     'Catalyst::Plugin::Session::Store::FastMmap' => '0.09',
202     'Catalyst::Controller::AllowDisable'         => '0.03',
203     'Reaction'                                   => '0.001999',
204     'Catalyst::Plugin::Upload::Image::Magick'    => '0.03',
205     'Catalyst::Plugin::ConfigLoader'             => '0.22', # Older versions work but
206                                                   # throw Data::Visitor warns
207     'Catalyst::Devel'                            => '1.19',
208     'Catalyst::Plugin::SmartURI'                 => '0.032',
209     'CatalystX::CRUD'                            => '0.37',
210     'Catalyst::Action::RenderView'               => '0.07',
211     'Catalyst::Plugin::DebugCookie'              => '0.999002',
212     'Catalyst::Plugin::Authentication'           => '0.100091',
213     'CatalystX::Imports'                         => '0.03',
214     'Catalyst::Plugin::HashedCookies'            => '1.03',
215     'Catalyst::Action::REST'                     => '0.67',
216     'CatalystX::CRUD'                            => '0.42',
217     'CatalystX::CRUD::Model::RDBO'               => '0.20',
218     'Catalyst::View::Mason'                      => '0.17',
219 #    Note these are not actually needed - they fail tests against the
220 #    new version, but still work fine..
221 #    'Catalyst::ActionRole::ACL'                  => '0.05',
222 #    'Catalyst::Plugin::Session::Store::DBIC'     => '0.11',
223       'Test::WWW::Mechanize::Catalyst'            => '0.53', # Dep warnings unless upgraded.
224 );
225 check_conflicts(%conflicts);
226
227 # End of script, helper functions below.
228
229 sub darwin_check_no_resource_forks {
230     if ($^O eq 'darwin') {
231         my $osx_ver = `/usr/bin/sw_vers -productVersion`;
232         chomp $osx_ver;
233
234         # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
235         # On 10.5 (Leopard) it wants COPYFILE_DISABLE
236          die("Oh, you got Ceiling Cat, snazzy. Please read the man page for tar or Google to find out if Apple renamed COPYFILE_DISABLE (it was COPY_EXTENDED_ATTRIBUTES_DISABLE originally) again and fix this Makefile.PL please?\n") if $osx_ver =~ /^10.8/;
237         my $attr = $osx_ver =~ /^10.(5|6|7)/  ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
238
239         makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
240                                           qq{ echo "You must set the ENV variable $attr to 'true',"; }.
241                                           ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
242     }
243 }