remove unneeded use lines
[p5sagit/Distar.git] / lib / Distar.pm
index 08c6046..510e3e7 100644 (file)
@@ -6,10 +6,7 @@ use base qw(Exporter);
 use ExtUtils::MakeMaker ();
 use ExtUtils::MM ();
 
-use Config;
-use File::Spec;
-
-our $VERSION = '0.001000';
+our $VERSION = '0.002000';
 $VERSION = eval $VERSION;
 
 my $MM_VER = eval $ExtUtils::MakeMaker::VERSION;
@@ -38,7 +35,7 @@ our @Manifest = (
   'xt' => '.t',
   'xt/lib' => '.pm',
   '' => qr{[^/]*\.PL},
-  '' => qr{Changes|MANIFEST|README|META\.yml},
+  '' => qr{Changes|MANIFEST|README|LICENSE|META\.yml},
   'maint' => qr{[^.].*},
 );
 
@@ -46,12 +43,8 @@ sub manifest_include {
   push @Manifest, @_;
 }
 
-my $readme_generator = <<'README';
-       pod2text $(VERSION_FROM) >$(DISTVNAME)/README
-       $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-readme-to-manifest
-README
 sub readme_generator {
-    $readme_generator = shift;
+  die "readme_generator unsupported" if @_ && $_[0];
 }
 
 sub write_manifest_skip {
@@ -105,29 +98,30 @@ sub write_manifest_skip {
     my $self = shift;
     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'
+    $dist_test .= <<"END";
 
 # --- Distar section:
+
+REMAKE = \$(PERLRUN) Makefile.PL @{[ map { $self->quote_literal($_) } @ARGV ]}
+
+END
+    $dist_test .= <<'END';
 preflight:
        $(ABSPERLRUN) Distar/helpers/preflight $(VERSION)
 release: preflight
        $(MAKE) disttest
-       rm -rf $(DISTVNAME)
+       $(RM_RF) $(DISTVNAME)
        $(MAKE) $(DISTVNAME).tar$(SUFFIX)
        git commit -a -m "Release commit for $(VERSION)"
        git tag v$(VERSION) -m "release v$(VERSION)"
        cpan-upload $(DISTVNAME).tar$(SUFFIX)
        git push origin v$(VERSION) HEAD
 distdir: readmefile
-readmefile: create_distdir
-END
-    . $readme_generator . <<'END';
+readmefile: create_distdir $(DISTVNAME)/README
+       $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-to-manifest README
+$(DISTVNAME)/README: $(VERSION_FROM)
+       $(NOECHO) $(MKPATH) $(DISTVNAME)
+       pod2text $(VERSION_FROM) >$(DISTVNAME)/README
 disttest: distmanicheck
 distmanicheck: create_distdir
        cd $(DISTVNAME) && $(ABSPERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck"
@@ -140,13 +134,18 @@ refresh:
        $(REMAKE)
 END
 
+    my $include = '';
+    if (open my $fh, '<', 'maint/Makefile.include') {
+      $include = "\n# --- Makefile.include:\n" . do { local $/; <$fh> };
+    }
+
     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
+       \$(ABSPERLRUN) Distar/helpers/bump-version --git \$(VERSION) $arg
+       \$(RM_F) \$(FIRST_MAKEFILE)
        \$(REMAKE)
 END
       }