4 use warnings FATAL => 'all';
6 use ExtUtils::MakeMaker ();
12 our $VERSION = '0.001000';
13 $VERSION = eval $VERSION;
16 author manifest_include run_preflight
21 warnings->import(FATAL => 'all');
22 shift->export_to_level(1,@_);
25 sub author { our $Author = shift }
36 '' => qr{Changes|MANIFEST|README|META\.yml},
37 'maint' => qr{[^.].*},
40 sub manifest_include {
44 sub write_manifest_skip {
45 my @files = @Manifest;
47 while (my ($dir, $spec) = splice(@files, 0, 2)) {
48 my $re = ($dir ? $dir.'/' : '').
49 ((ref($spec) eq 'Regexp')
53 # print ref as well as stringification in case of overload ""
54 : die "spec must be string or regexp, was: ${spec} (${\ref $spec})");
57 my $final = '^(?!'.join('|', map "${_}\$", @parts).')';
58 open my $skip, '>', 'MANIFEST.SKIP'
59 or die "can't open MANIFEST.SKIP: $!";
60 print $skip "${final}\n";
66 my $version = $ARGV[0];
68 my $make = $Config{make};
69 my $null = File::Spec->devnull;
72 if (system("git rev-parse --quiet --verify v$version >$null") == 0) {
73 die "Tag v$version already exists!";
77 File::Find::find({ no_chdir => 1, wanted => sub {
80 my $file_version = MM->parse_version($_);
81 die "Module $_ version $file_version doesn't match dist version $version"
82 unless $file_version eq 'undef' || $file_version eq $version;
85 for (scalar `"$make" manifest 2>&1 >$null`) {
86 $_ && die "$make manifest changed:\n$_ Go check it and retry";
89 for (scalar `git status`) {
90 /^(?:# )?On branch master/ || die "Not on master. EEEK";
91 /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream";
94 for (scalar `git diff`) {
95 length && die "Outstanding changes";
98 "%i-%02i-%02i", (localtime)[5]+1900, (localtime)[4]+1, (localtime)[3]
100 my $changes_line = "$version - $ymd\n";
101 my @cached = grep /^\+/, `git diff --cached -U0`;
102 @cached > 0 or die "Please add:\n\n$changes_line\nto Changes stage Changes (git add Changes)";
103 @cached == 2 or die "Pre-commit Changes not just Changes line";
104 $cached[0] =~ /^\+\+\+ .\/Changes\n/ or die "Changes not changed";
105 $cached[1] eq "+$changes_line" or die "Changes new line should be: \n\n$changes_line ";
107 { no warnings 'exec'; `cpan-upload -h`; }
108 $? and die "cpan-upload not available";
113 our @ISA = @ExtUtils::MM::ISA;
114 @ExtUtils::MM::ISA = (__PACKAGE__);
117 my ($class, $args) = @_;
118 return $class->SUPER::new({
121 AUTHOR => $Distar::Author,
122 ABSTRACT_FROM => $args->{VERSION_FROM},
123 test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t xt/*/*.t' },
129 my $manicheck = '$(PERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck"';
130 my $test = $self->can('cd') ? $self->cd('$(DISTVNAME)', $manicheck)
131 : 'cd $(DISTVNAME) && ' . $manicheck;
132 my $dist_test = $self->SUPER::dist_test(@_) . sprintf(<<'END', $test);
134 # --- Distar section:
136 perl -IDistar/lib -MDistar -erun_preflight $(VERSION)
140 $(MAKE) $(DISTVNAME).tar$(SUFFIX)
141 git commit -a -m "Release commit for $(VERSION)"
142 git tag v$(VERSION) -m "release v$(VERSION)"
143 cpan-upload $(DISTVNAME).tar$(SUFFIX)
144 git push origin v$(VERSION) HEAD
146 readmefile: create_distdir
147 pod2text $(VERSION_FROM) >$(DISTVNAME)/README
148 $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-readme-to-manifest
149 disttest: distmanicheck
150 distmanicheck: distdir
154 if (open my $fh, '<', 'maint/Makefile.include') {
155 $dist_test .= do { local $/; <$fh> };
162 write_manifest_skip() unless $Ran_Preflight