3 use warnings FATAL => 'all';
7 use ExtUtils::MakeMaker ();
8 use Getopt::Long qw(:config gnu_getopt);
11 "branch=s" => \(my $branch = 'master'),
12 ) or die("Error in command line arguments\n");
14 my $version = shift or die "version required!";
16 my $make = $Config{make};
17 my $null = File::Spec->devnull;
20 if (system("git rev-parse --quiet --verify v$version >$null") == 0) {
21 die "Tag v$version already exists!";
24 File::Find::find({ no_chdir => 1, wanted => sub {
27 my $file_version = MM->parse_version($_);
28 die "Module $_ version $file_version doesn't match dist version $version"
29 unless $file_version eq 'undef' || $file_version eq $version;
32 for (scalar `"$make" manifest 2>&1 >$null`) {
33 $_ && die "$make manifest changed:\n$_ Go check it and retry";
36 for (scalar `git status`) {
37 /^(?:# )?On branch \Q$branch\E/ || die "Not on $branch. EEEK";
38 /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream";
41 for (scalar `git diff`) {
42 length && die "Outstanding changes";
45 "%i-%02i-%02i", (gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3]
47 my $changes_line = "$version - $ymd\n";
48 my @cached = grep /^\+/, `git diff --cached -U0`;
49 @cached > 0 or die "Please add:\n\n$changes_line\nto Changes stage Changes (git add Changes)";
50 @cached == 2 or die "Pre-commit Changes not just Changes line";
51 $cached[0] =~ /^\+\+\+ .\/Changes\n/ or die "Changes not changed";
52 $cached[1] eq "+$changes_line" or die "Changes new line should be: \n\n$changes_line ";
54 { no warnings 'exec'; `cpan-upload -h`; }
55 $? and die "cpan-upload not available";