Make tests use strict and warnings. Cleanup the killing of activemq so that it happen...
[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::Runtime'  => '5.80004';
11 requires 'Moose' => undef;
12 requires 'MooseX::Workers' => '0.05';
13 requires 'Net::Stomp' => '0.34';
14 requires 'YAML::XS' => '0.32';
15 requires 'Data::Serializer' => '0.49';
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 no_index package => 'StompTestApp::Controller::TestJsonController';
23
24 my @force_build_requires_if_author = qw(
25   Test::NoTabs
26   Test::Pod
27   Test::Pod::Coverage
28   Pod::Coverage
29 );
30
31 if ($Module::Install::AUTHOR) {
32     foreach my $module (@force_build_requires_if_author) {
33         build_requires $module;
34     }
35     darwin_check_no_resource_forks();
36 }
37
38 install_script glob('script/*.pl');
39 auto_install;
40 WriteAll;
41
42 if ($Module::Install::AUTHOR) {
43
44   # Strip out the author only build_requires from META.yml
45   # Need to do this _after_ WriteAll else it looses track of them
46   strip_author_only_build_requires(@force_build_requires_if_author);
47
48   Meta->{values}{resources} = [
49     [ 'license',    => 'http://dev.perl.org/licenses/' ],
50     [ 'repository', => 'git://github.com/chrisa/catalyst-engine-stomp.git' ],
51   ];
52
53   Meta->write;
54 }
55
56 sub darwin_check_no_resource_forks {
57     if ($^O eq 'darwin') {
58         my $osx_ver = `/usr/bin/sw_vers -productVersion`;
59         chomp $osx_ver;
60
61         # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
62         # On 10.5 (Leopard) it wants COPYFILE_DISABLE
63         my $attr = $osx_ver eq '10.5' ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
64
65         makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
66                                           qq{ echo "You must set the ENV variable $attr to true,"; }.
67                                           ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
68         }
69 }
70
71 sub strip_author_only_build_requires {
72     my @build_requires_to_strip = @_;
73     Meta->{values}{build_requires} = [ grep {
74       my $ok = 1;
75       foreach my $module (@build_requires_to_strip) {
76         if ($_->[0] =~ /$module/) {
77           $ok = 0;
78           last;
79         }
80       }
81       $ok;
82     } @{Meta->{values}{build_requires}} ];
83 }
84