move Author.PL to maint/Makefile.PL.include to prevent it being run at build time
[p5sagit/Module-Metadata.git] / maint / Makefile.PL.include
1 use strict;
2 use warnings FATAL => 'all';
3
4 my $POSTAMBLE = q{bump:
5         maint/bump-version
6 bumpminor:
7         maint/bump-version minor
8 bumpmajor:
9         maint/bump-version major
10 };
11
12 {
13   package MY;
14
15   {
16     no warnings 'once'; push @ExtUtils::MakeMaker::Overridable, 'find_tests';
17   }
18
19   sub find_tests {
20     shift->SUPER::find_tests.' xt/*.t';
21   }
22
23   sub postamble { $POSTAMBLE }
24 }
25
26 {
27   no warnings 'redefine';
28   sub WriteMakefile {
29     my %args = @_;
30     ExtUtils::MakeMaker::WriteMakefile(
31       %args,
32       AUTHOR => 'Ken Williams <kwilliams@cpan.org>, Randy W. Sims <RandyS@ThePierianSpring.org>',
33       ABSTRACT_FROM => $args{VERSION_FROM},
34     );
35   }
36 }
37
38 sub manifest_include {
39   use autodie;
40   my @files = @_;
41   my @parts;
42   while (my ($dir, $spec) = splice(@files, 0, 2)) {
43     my $re = ($dir ? $dir.'/' : '').
44       ((ref($spec) eq 'Regexp')
45         ? $spec
46         : !ref($spec)
47           ? ".*\Q${spec}\E"
48           : die "spec must be string or regexp, was: ${spec} (${\ref $spec})");
49     push @parts, $re;
50   }
51   my $final = '^(?!'.join('|', map "${_}\$", @parts).')';
52   open my $skip, '>', 'MANIFEST.SKIP';
53   print $skip "${final}\n";
54   close $skip;
55 }
56
57 manifest_include(
58   'lib' => '.pm',
59   't' => '.t',
60   't/lib' => '.pm',
61   'xt' => '.t',
62   'xt/lib' => '.pm',
63   '' => '.PL',
64   '' => qr{Changes|MANIFEST|README|META\.yml}
65 );
66
67 1;