39067602c4cc9915c282fe2f281143c8149e02a9
[gitmo/Moose.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install 0.97;
4 use Module::Install::AuthorRequires;
5 use 5.008001;
6
7 check_broken_extratests();
8 check_conflicts();
9
10 name 'Moose';
11 perl_version '5.008001';
12 all_from 'lib/Moose.pm';
13 license 'perl';
14
15 requires 'Carp';
16 requires 'Class::MOP'       => '1.01';
17 requires 'Data::OptList'    => '0';
18 requires 'List::MoreUtils'  => '0.12';
19 requires 'Scalar::Util'     => '1.19';
20 requires 'Sub::Exporter'    => '0.980';
21 requires 'Sub::Name'        => '0';
22 requires 'Task::Weaken'     => '0';
23 requires 'Try::Tiny'        => '0.02';
24
25 test_requires 'Test::More'      => '0.88';
26 test_requires 'Test::Exception' => '0.27';
27
28 author_requires 'Test::Inline';
29 author_requires 'File::Find::Rule';
30 author_requires 'Module::Info';
31 author_requires 'Test::Spelling';
32 author_requires 'Test::Pod::Coverage';
33 author_requires 'Test::NoTabs';
34
35 if ( is_maintainer() ) {
36     system( $^X, 'author/extract-inline-tests' );
37 }
38
39 tests_recursive();
40
41 repository 'git://git.moose.perl.org/Moose.git';
42
43 WriteAll();
44
45 # Use the cpan-smolder-stable script in the Moose svn root to figure
46 # out what on CPAN will break with the latest Moose, then update this
47 # before a release.
48 sub check_conflicts {
49     my %conflicts = (
50         'Devel::REPL'                   => '1.003008',
51         'Fey::ORM'                      => '0.23',
52         'Catalyst'                      => '5.80017',
53         'MooseX::Aliases'               => '0.07',
54         'MooseX::AttributeHelpers'      => '0.22',
55         'MooseX::Attribute::Prototype'  => '0.10',
56         'MooseX::ClassAttribute'        => '0.09',
57         'MooseX::MethodAttributes'      => '0.18',
58         'MooseX::NonMoose'              => '0.05',
59         'MooseX::Params::Validate'      => '0.05',
60         'MooseX::Role::Cmd'             => '0.06',
61         'MooseX::Role::WithOverloading' => '0.04',
62         'MooseX::Singleton'             => '0.19',
63         'MooseX::StrictConstructor'     => '0.07',
64         'MooseX::Types'                 => '0.19',
65         'namespace::autoclean'          => '0.08',
66         'KiokuDB'                       => '0.41',
67     );
68
69     my $found = 0;
70     for my $mod ( sort keys %conflicts ) {
71         eval "require $mod";
72         next if $@;
73
74         my $installed = $mod->VERSION();
75         if ( $installed le $conflicts{$mod} ) {
76
77             print <<"EOF";
78
79 ***
80     This version of Moose conflicts with the version of
81     $mod ($installed) you have installed.
82
83     You will need to upgrade $mod after installing
84     this version of Moose.
85 ***
86
87 EOF
88
89             $found = 1;
90         }
91     }
92
93     return unless $found;
94
95     # More or less copied from Module::Build
96     return if  $ENV{PERL_MM_USE_DEFAULT};
97     return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
98
99     sleep 4;
100 }
101
102 sub is_maintainer {
103     return $Module::Install::AUTHOR || $ENV{IS_MAINTAINER};
104 }
105
106 sub check_broken_extratests {
107     return unless is_maintainer();
108
109     if ( exists $Module::Install::ExtraTests::{VERSION} && Module::Install::ExtraTests->VERSION < 0.007 ) {
110         print STDERR <<'EOR';
111 You have a broken version of Module::Install::ExtraTests installed.
112 Please upgrade to version 0.007 or newer and re-run Makefile.PL
113 EOR
114         exit 0;
115     }
116 }