add FAKE_RELEASE option to skip uploading
[p5sagit/Distar.git] / lib / Distar.pm
index 927d105..8bf1f61 100644 (file)
@@ -102,6 +102,8 @@ sub write_manifest_skip {
     my $phony_targets = join ' ', qw(
       preflight
       check-version
+      check-manifest
+      check-cpan-upload
       releasetest
       release
       readmefile
@@ -132,6 +134,8 @@ sub write_manifest_skip {
       REMAKE => join(' ', '$(PERLRUN)', 'Makefile.PL', map { $self->quote_literal($_) } @ARGV),
       BRANCH => $self->{BRANCH} ||= 'master',
       CHANGELOG => $self->{CHANGELOG} ||= 'Changes',
+      DEV_NULL_STDOUT => ($self->{DEV_NULL} ? '>'.File::Spec->devnull : ''),
+      FAKE_RELEASE => '',
     );
 
     join('',
@@ -140,10 +144,14 @@ sub write_manifest_skip {
       (map "$_ = $vars{$_}\n", sort keys %vars),
       <<'END',
 
-preflight: check-version
+preflight: check-version check-manifest check-cpan-upload
        $(ABSPERLRUN) Distar/helpers/preflight $(VERSION) --changelog=$(CHANGELOG) --branch=$(BRANCH)
 check-version:
        $(ABSPERLRUN) Distar/helpers/check-version $(VERSION) $(TO_INST_PM) $(EXE_FILES)
+check-manifest:
+       $(ABSPERLRUN) Distar/helpers/check-manifest
+check-cpan-upload:
+       $(NOECHO) cpan-upload -h $(DEV_NULL_STDOUT)
 releasetest:
        $(MAKE) disttest RELEASE_TESTING=1 PASTHRU="$(PASTHRU) TEST_FILES=\"$(TEST_FILES)\""
 release: preflight releasetest
@@ -151,6 +159,10 @@ release: preflight releasetest
        $(MAKE) $(DISTVNAME).tar$(SUFFIX)
        git commit -a -m "Release commit for $(VERSION)"
        git tag v$(VERSION) -m "release v$(VERSION)"
+       $(NOECHO) $(MAKE) pushrelease FAKE_RELEASE=$(FAKE_RELEASE)
+pushrelease ::
+       $(NOECHO) $(NOOP)
+pushrelease$(FAKE_RELEASE) ::
        cpan-upload $(DISTVNAME).tar$(SUFFIX)
        git push origin v$(VERSION) HEAD
 distdir: readmefile
@@ -286,6 +298,11 @@ 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
+
+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.
+
 =head2 preflight
 
 Performs a number of checks on the files and repository, ensuring it is in a