Hack module install to ensure we _require_ the stuff for the optional tests if you...
[catagits/Catalyst-Engine-STOMP.git] / Makefile.PL
1 use inc::Module::Install;
2 use 5.008006;
3
4 license  'perl';
5
6 name     'Catalyst-Engine-Stomp';
7 all_from 'lib/Catalyst/Engine/Stomp.pm';
8
9 requires 'Catalyst::Engine::Embeddable'  => '0.0.1';
10 requires 'Catalyst::Action::REST' => undef;
11 requires 'Catalyst::Runtime'  => '5.80004';
12 requires 'Moose' => undef;
13 requires 'MooseX::Workers' => '0.05';
14 requires 'Net::Stomp' => '0.34';
15 requires 'YAML::XS' => '0.32';
16 requires 'namespace::autoclean' => '0.05';
17
18 test_requires 'Alien::ActiveMQ' => '0.00003';
19
20 no_index package => 'StompTestApp';
21 no_index package => 'StompTestApp::Controller::TestController';
22
23 my @force_build_requires_if_author = qw(
24   Test::NoTabs
25   Test::Pod
26   Test::Pod::Coverage
27   Pod::Coverage
28 );
29
30 if ($Module::Install::AUTHOR) {
31     foreach my $module (@force_build_requires_if_author) {
32         build_requires $module;
33     }
34     darwin_check_no_resource_forks();
35 }
36
37 install_script glob('script/*.pl');
38 auto_install;
39 WriteAll;
40
41 if ($Module::Install::AUTHOR) {
42
43   # Strip out the author only build_requires from META.yml
44   # Need to do this _after_ WriteAll else it looses track of them
45   strip_author_only_build_requires(@force_build_requires_if_author);
46
47   Meta->{values}{resources} = [
48     [ 'license',    => 'http://dev.perl.org/licenses/' ],
49     [ 'repository', => 'git://github.com/chrisa/catalyst-engine-stomp.git' ],
50   ];
51
52   Meta->write;
53 }
54
55 sub darwin_check_no_resource_forks {
56     if ($^O eq 'darwin') {
57         my $osx_ver = `/usr/bin/sw_vers -productVersion`;
58         chomp $osx_ver;
59
60         # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
61         # On 10.5 (Leopard) it wants COPYFILE_DISABLE
62         my $attr = $osx_ver eq '10.5' ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
63
64         makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
65                                           qq{ echo "You must set the ENV variable $attr to true,"; }.
66                                           ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
67         }
68 }
69
70 sub strip_author_only_build_requires {
71     my @build_requires_to_strip = @_;
72     Meta->{values}{build_requires} = [ grep {
73       my $ok = 1;
74       foreach my $module (@build_requires_to_strip) {
75         if ($_->[0] =~ /$module/) {
76           $ok = 0;
77           last;
78         }
79       }
80       $ok;
81     } @{Meta->{values}{build_requires}} ];
82 }
83