hook into EUMM at a higher level
[p5sagit/Distar.git] / lib / Distar.pm
index dc43ad0..72b8c2d 100644 (file)
@@ -122,18 +122,22 @@ sub run_preflight {
 
 {
   package Distar::MM;
-  our @ISA = @ExtUtils::MM::ISA;
-  @ExtUtils::MM::ISA = (__PACKAGE__);
+  our @ISA = @MM::ISA;
+  @MM::ISA = (__PACKAGE__);
 
   sub new {
     my ($class, $args) = @_;
     return $class->SUPER::new({
       LICENSE => 'perl_5',
       MIN_PERL_VERSION => '5.006',
-      AUTHOR => ($MM_VER >= 6.5702 ? $Distar::Author : $Distar::Author->[0]),
+      AUTHOR => ($MM_VER >= 6.5702 ? $Distar::Author : join(', ', @$Distar::Author)),
       %$args,
       ABSTRACT_FROM => $args->{VERSION_FROM},
       test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t xt/*/*.t' },
+      realclean => { FILES => (
+        ($args->{realclean}{FILES}||'')
+        . ' Distar/ MANIFEST.SKIP MANIFEST MANIFEST.bak'
+      ) },
     });
   }
 
@@ -145,7 +149,15 @@ sub run_preflight {
 
   sub dist_test {
     my $self = shift;
-    my $dist_test = $self->SUPER::dist_test(@_) . <<'END'
+    my $dist_test = $self->SUPER::dist_test(@_);
+
+    my $include = '';
+    if (open my $fh, '<', 'maint/Makefile.include') {
+      $include = "\n# --- Makefile.include:\n" . do { local $/; <$fh> };
+    }
+
+    $dist_test .= "REMAKE = \$(PERLRUN) Makefile.PL @{[ map { $self->quote_literal($_) } @ARGV ]}";
+    $dist_test .= <<'END'
 
 # --- Distar section:
 preflight:
@@ -165,11 +177,29 @@ END
 disttest: distmanicheck
 distmanicheck: create_distdir
        cd $(DISTVNAME) && $(ABSPERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck"
+nextrelease:
+       $(ABSPERLRUN) Distar/helpers/add-changelog-heading $(VERSION) Changes
+       git add -p Changes
+refresh:
+       cd Distar && git pull
+       rm Makefile
+       $(REMAKE)
+END
 
+    for my $type ('', 'minor', 'major') {
+      if ($include !~ /^bump$type:/m) {
+        my $arg = $type || '$(V)';
+        $dist_test .= <<"END"
+bump$type:
+       Distar/helpers/bump-version --git \$(VERSION) $arg
+       rm Makefile
+       \$(REMAKE)
 END
-    if (open my $fh, '<', 'maint/Makefile.include') {
-      $dist_test .= do { local $/; <$fh> };
+      }
     }
+
+    $dist_test .= $include . "\n";
+
     return $dist_test;
   }
 }