whitespace cleanup
[p5sagit/Distar.git] / lib / Distar.pm
index 8c36df6..f27036d 100644 (file)
@@ -1,6 +1,7 @@
 package Distar;
 
-use strictures 1;
+use strict;
+use warnings FATAL => 'all';
 use base qw(Exporter);
 use ExtUtils::MakeMaker ();
 use ExtUtils::MM ();
@@ -40,7 +41,6 @@ sub manifest_include {
 }
 
 sub write_manifest_skip {
-  use autodie;
   my @files = @Manifest;
   my @parts;
   while (my ($dir, $spec) = splice(@files, 0, 2)) {
@@ -54,7 +54,8 @@ sub write_manifest_skip {
     push @parts, $re;
   }
   my $final = '^(?!'.join('|', map "${_}\$", @parts).')';
-  open my $skip, '>', 'MANIFEST.SKIP';
+  open my $skip, '>', 'MANIFEST.SKIP'
+    or die "can't open MANIFEST.SKIP: $!";
   print $skip "${final}\n";
   close $skip;
 }
@@ -63,11 +64,14 @@ sub run_preflight {
   $Ran_Preflight = 1;
   my $version = $ARGV[0];
 
-  system("git fetch");
-
   my $make = $Config{make};
   my $null = File::Spec->devnull;
 
+  system("git fetch");
+  if (system("git rev-parse --quiet --verify v$version >$null") == 0) {
+    die "Tag v$version already exists!";
+  }
+
   require File::Find;
   File::Find::find({ no_chdir => 1, wanted => sub {
     return
@@ -82,7 +86,7 @@ sub run_preflight {
   }
 
   for (scalar `git status`) {
-    /^# On branch master/ || die "Not on master. EEEK";
+    /^(?:# )?On branch master/ || die "Not on master. EEEK";
     /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream";
   }
 
@@ -92,11 +96,12 @@ sub run_preflight {
   my $ymd = sprintf(
     "%i-%02i-%02i", (localtime)[5]+1900, (localtime)[4]+1, (localtime)[3]
   );
+  my $changes_line = "$version - $ymd\n";
   my @cached = grep /^\+/, `git diff --cached -U0`;
-  @cached > 0 or die "Please add:\n\n$version   $ymd\n\nto Changes stage Changes (git add Changes)";
+  @cached > 0 or die "Please add:\n\n$changes_line\nto Changes stage Changes (git add Changes)";
   @cached == 2 or die "Pre-commit Changes not just Changes line";
   $cached[0] =~ /^\+\+\+ .\/Changes\n/ or die "Changes not changed";
-  $cached[1] eq "+$version - $ymd\n" or die "Changes new line should be: \n\n$version - $ymd\n ";
+  $cached[1] eq "+$changes_line" or die "Changes new line should be: \n\n$changes_line ";
 }
 
 {