update docs
[p5sagit/Distar.git] / lib / Distar.pm
index c0950ca..ae877ea 100644 (file)
@@ -77,13 +77,18 @@ sub write_manifest_skip {
 
   sub new {
     my ($class, $args) = @_;
+    my %test = %{$args->{test}||{}};
+    my $tests = $test{TESTS} || 't/*.t';
+    $tests !~ /\b\Q$_\E\b/ and $tests .= " $_"
+      for 'xt/*.t', 'xt/*/*.t';
+    $test{TESTS} = $tests;
     return $class->SUPER::new({
       LICENSE => 'perl_5',
       MIN_PERL_VERSION => '5.006',
       AUTHOR => ($MM_VER >= 6.5702 ? $Distar::Author : join(', ', @$Distar::Author)),
       (exists $args->{ABSTRACT} ? () : (ABSTRACT_FROM => $args->{VERSION_FROM})),
       %$args,
-      test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t xt/*/*.t' },
+      test => \%test,
       realclean => { FILES => (
         ($args->{realclean}{FILES}||'')
         . ' Distar/ MANIFEST.SKIP MANIFEST MANIFEST.bak'
@@ -93,7 +98,11 @@ sub write_manifest_skip {
 
   sub flush {
     my $self = shift;
-    Distar::write_manifest_skip($self);
+    `git ls-files --error-unmatch MANIFEST.SKIP 2>&1`;
+    my $maniskip_tracked = !$?;
+
+    Distar::write_manifest_skip($self)
+      unless $maniskip_tracked;
     $self->SUPER::flush(@_);
   }
 
@@ -140,7 +149,7 @@ sub write_manifest_skip {
     my %vars = (
       DISTAR => $self->quote_literal($distar),
       HELPERS => $self->quote_literal($helpers),
-      REMAKE => join(' ', '$(PERLRUN)', 'Makefile.PL', map { $self->quote_literal($_) } @ARGV),
+      REMAKE => join(' ', '$(PERLRUN)', '-I$(DISTAR)/lib', '-mDistar', 'Makefile.PL', map { $self->quote_literal($_) } @ARGV),
       BRANCH => $self->{BRANCH} ||= 'master',
       CHANGELOG => $self->{CHANGELOG} ||= 'Changes',
       DEV_NULL_STDOUT => ($self->{DEV_NULL} ? '>'.File::Spec->devnull : ''),
@@ -177,18 +186,19 @@ pushrelease$(FAKE_RELEASE) ::
        git push origin v$(VERSION) HEAD
 distdir: readmefile
 readmefile: create_distdir
-       $(NOECHO) $(MAKE) $(DISTVNAME)/README
+       $(NOECHO) $(TEST_F) $(DISTVNAME)/README || $(MAKE) $(DISTVNAME)/README
 $(DISTVNAME)/README: $(VERSION_FROM)
        $(NOECHO) $(MKPATH) $(DISTVNAME)
        pod2text $(VERSION_FROM) >$(DISTVNAME)/README
        $(NOECHO) $(ABSPERLRUN) $(HELPERS)/add-to-manifest -d $(DISTVNAME) README
+distsignature: readmefile
 disttest: distmanicheck
 distmanicheck: create_distdir
        cd $(DISTVNAME) && $(ABSPERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck"
 nextrelease:
        $(ABSPERLRUN) $(HELPERS)/add-changelog-heading --git $(VERSION) $(CHANGELOG)
 refresh:
-       cd $(DISTAR) && git pull
+       cd $(DISTAR) && git pull || $(TRUE)
        $(RM_F) $(FIRST_MAKEFILE)
        $(REMAKE)
 END
@@ -216,7 +226,7 @@ Distar - Additions to ExtUtils::MakeMaker for dist authors
 F<Makefile.PL>:
 
   use ExtUtils::MakeMaker;
-  (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
+  (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
 
   WriteMakefile(...);
 
@@ -241,8 +251,12 @@ make commmands:
   $ make nextrelease      # add version heading to Changes file
   $ make releasetest      # build dist and test (with xt/ and RELEASE_TESTING=1)
   $ make preflight        # check that repo and file state is release ready
-  $ make release          # check releasetest and preflight, then build and
-                          # upload to CPAN, tag release, push tag and branch
+  $ make release          # check releasetest and preflight, commits and tags,
+                          # builds and uploads to CPAN, and pushes commits and
+                          # tag
+  $ make release FAKE_RELEASE=1
+                          # builds a release INCLUDING committing and tagging,
+                          # but does not upload to cpan or push anything to git
 
 =head1 DESCRIPTION
 
@@ -308,7 +322,7 @@ C<preflight> and C<releasetest> commands.
 Releasing will generate a dist tarball and upload it to CPAN using cpan-upload.
 It will also create a git tag for the release, and push the tag and branch.
 
-=head2 FAKE_RELEASE
+=head3 FAKE_RELEASE
 
 If release is run with FAKE_RELEASE=1 set, it will skip uploading to CPAN and
 pushing to git.  A release commit will still be created and tagged locally.
@@ -352,13 +366,40 @@ change.
 =head2 bump
 
 Bumps the version number.  This will try to preserve the length and format of
-the version number.  The least significant digit will be incremented.
+the version number.  The least significant digit will be incremented.  Versions
+with underscores will preserve the underscore in the same position.
 
 Optionally accepts a C<V> option to set the version to a specific value.
 
 The version changes will automatically be committed.  Unstaged modifications to
 the files will be left untouched.
 
+=head3 V
+
+The V option will be passed along to the version bumping script.  It can accept
+a space separated list of options, including an explicit version number.
+
+Options:
+
+=over 4
+
+=item --force
+
+Updates version numbers even if they do not match the current expected version
+number.
+
+=item --stable
+
+Attempts to convert the updated version to a stable version, removing any
+underscore.
+
+=item --alpha
+
+Attempts to convert the updated version to an alpha version, adding an
+underscore in an appropriate place.
+
+=back
+
 =head2 bumpminor
 
 Like bump, but increments the minor segment of the version.  This will treat
@@ -388,7 +429,7 @@ mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
 
 haarg - Graham Knop (cpan:HAARG) <haarg@cpan.org>
 
-ether = Karen Etheridge (cpan:ETHER) <ether@cpan.org>
+ether - Karen Etheridge (cpan:ETHER) <ether@cpan.org>
 
 frew - Arthur Axel "fREW" Schmidt (cpan:FREW) <frioux@gmail.com>