Hack module install to ensure we _require_ the stuff for the optional tests if you...
[catagits/Catalyst-Engine-STOMP.git] / Makefile.PL
CommitLineData
b919b4cc 1use inc::Module::Install;
2use 5.008006;
48bc6cd6 3
68e73c9f 4license 'perl';
5
b919b4cc 6name 'Catalyst-Engine-Stomp';
7all_from 'lib/Catalyst/Engine/Stomp.pm';
48bc6cd6 8
b919b4cc 9requires 'Catalyst::Engine::Embeddable' => '0.0.1';
0b407261 10requires 'Catalyst::Action::REST' => undef;
092efce5 11requires 'Catalyst::Runtime' => '5.80004';
b919b4cc 12requires 'Moose' => undef;
13requires 'MooseX::Workers' => '0.05';
48bc6cd6 14requires 'Net::Stomp' => '0.34';
b919b4cc 15requires 'YAML::XS' => '0.32';
16requires 'namespace::autoclean' => '0.05';
17
a431050d 18test_requires 'Alien::ActiveMQ' => '0.00003';
6ac87378 19
68e73c9f 20no_index package => 'StompTestApp';
625835bf 21no_index package => 'StompTestApp::Controller::TestController';
68e73c9f 22
e946eafd 23my @force_build_requires_if_author = qw(
24 Test::NoTabs
25 Test::Pod
26 Test::Pod::Coverage
27 Pod::Coverage
28);
29
30if ($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
37install_script glob('script/*.pl');
b919b4cc 38auto_install;
39WriteAll;
40
e946eafd 41if ($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
55sub 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
70sub 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