4 use warnings FATAL => 'all';
6 use ExtUtils::MakeMaker ();
12 our $VERSION = '0.001000';
13 $VERSION = eval $VERSION;
15 my $MM_VER = eval $ExtUtils::MakeMaker::VERSION;
18 author manifest_include readme_generator
23 warnings->import(FATAL => 'all');
24 shift->export_to_level(1,@_);
41 '' => qr{Changes|MANIFEST|README|META\.yml},
42 'maint' => qr{[^.].*},
45 sub manifest_include {
49 my $readme_generator = <<'README';
50 pod2text $(VERSION_FROM) >$(DISTVNAME)/README
51 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-to-manifest README
53 sub readme_generator {
54 $readme_generator = shift;
57 sub write_manifest_skip {
58 my @files = @Manifest;
60 while (my ($dir, $spec) = splice(@files, 0, 2)) {
61 my $re = ($dir ? $dir.'/' : '').
62 ((ref($spec) eq 'Regexp')
66 # print ref as well as stringification in case of overload ""
67 : die "spec must be string or regexp, was: ${spec} (${\ref $spec})");
70 my $final = '^(?!'.join('|', map "${_}\$", @parts).')';
71 open my $skip, '>', 'MANIFEST.SKIP'
72 or die "can't open MANIFEST.SKIP: $!";
73 print $skip "${final}\n";
80 @MM::ISA = (__PACKAGE__);
83 my ($class, $args) = @_;
84 return $class->SUPER::new({
86 MIN_PERL_VERSION => '5.006',
87 AUTHOR => ($MM_VER >= 6.5702 ? $Distar::Author : join(', ', @$Distar::Author)),
89 ABSTRACT_FROM => $args->{VERSION_FROM},
90 test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t xt/*/*.t' },
91 realclean => { FILES => (
92 ($args->{realclean}{FILES}||'')
93 . ' Distar/ MANIFEST.SKIP MANIFEST MANIFEST.bak'
100 Distar::write_manifest_skip();
101 $self->SUPER::flush(@_);
106 my $dist_test = $self->SUPER::dist_test(@_);
108 $dist_test .= <<"END";
110 # --- Distar section:
112 REMAKE = \$(PERLRUN) Makefile.PL @{[ map { $self->quote_literal($_) } @ARGV ]}
115 $dist_test .= <<'END';
117 $(ABSPERLRUN) Distar/helpers/preflight $(VERSION)
120 $(RM_RF) $(DISTVNAME)
121 $(MAKE) $(DISTVNAME).tar$(SUFFIX)
122 git commit -a -m "Release commit for $(VERSION)"
123 git tag v$(VERSION) -m "release v$(VERSION)"
124 cpan-upload $(DISTVNAME).tar$(SUFFIX)
125 git push origin v$(VERSION) HEAD
127 readmefile: create_distdir
129 . $readme_generator . <<'END';
130 disttest: distmanicheck
131 distmanicheck: create_distdir
132 cd $(DISTVNAME) && $(ABSPERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck"
134 $(ABSPERLRUN) Distar/helpers/add-changelog-heading $(VERSION) Changes
137 cd Distar && git pull
143 if (open my $fh, '<', 'maint/Makefile.include') {
144 $include = "\n# --- Makefile.include:\n" . do { local $/; <$fh> };
147 for my $type ('', 'minor', 'major') {
148 if ($include !~ /^bump$type:/m) {
149 my $arg = $type || '$(V)';
150 $dist_test .= <<"END"
152 \$(ABSPERLRUN) Distar/helpers/bump-version --git \$(VERSION) $arg
153 \$(RM_F) \$(FIRST_MAKEFILE)
159 $dist_test .= $include . "\n";