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