X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDistar.pm;h=8e1c51d3fdb358ff4962ca099c7567e4e983de13;hb=9b920c5cd3611f36624ec9eb87f5ef822e0fe465;hp=44e1a91316f70352538b6b4d79e7380eab565ee3;hpb=fef5ecd3c8427379455376fd63cf439e7334cbe5;p=p5sagit%2FDistar.git diff --git a/lib/Distar.pm b/lib/Distar.pm index 44e1a91..8e1c51d 100644 --- a/lib/Distar.pm +++ b/lib/Distar.pm @@ -1,5 +1,4 @@ package Distar; - use strict; use warnings FATAL => 'all'; use base qw(Exporter); @@ -81,8 +80,8 @@ sub write_manifest_skip { LICENSE => 'perl_5', MIN_PERL_VERSION => '5.006', AUTHOR => ($MM_VER >= 6.5702 ? $Distar::Author : join(', ', @$Distar::Author)), - %$args, ABSTRACT_FROM => $args->{VERSION_FROM}, + %$args, test => { TESTS => ($args->{test}{TESTS}||'t/*.t').' xt/*.t xt/*/*.t' }, realclean => { FILES => ( ($args->{realclean}{FILES}||'') @@ -100,26 +99,50 @@ sub write_manifest_skip { sub special_targets { my $self = shift; my $targets = $self->SUPER::special_targets(@_); - $targets =~ s/^(\.PHONY\s*:.*)/$1 preflight releasetest release readmefile distmanicheck nextrelease refresh bump bumpmajor bumpminor/m; + my $phony_targets = join ' ', qw( + preflight + releasetest + release + readmefile + distmanicheck + nextrelease + refresh + bump + bumpmajor + bumpminor + ); + $targets =~ s/^(\.PHONY *:.*)/$1 $phony_targets/m; $targets; } sub dist_test { my $self = shift; - my $dist_test = $self->SUPER::dist_test(@_); - $dist_test .= <<"END"; + my $include = ''; + if (open my $fh, '<', 'maint/Makefile.include') { + $include = "\n# --- Makefile.include:\n\n" . do { local $/; <$fh> }; + $include =~ s/\n?\z/\n/; + } -# --- Distar section: + my @bump_targets = + grep { $include !~ /^bump$_(?: +\w+)*:/m } ('', 'minor', 'major'); -REMAKE = \$(PERLRUN) Makefile.PL @{[ map { $self->quote_literal($_) } @ARGV ]} + my %vars = ( + REMAKE => join(' ', '$(PERLRUN)', 'Makefile.PL', map { $self->quote_literal($_) } @ARGV), + BRANCH => $self->{BRANCH} ||= 'master', + CHANGELOG => $self->{CHANGELOG} ||= 'Changes', + ); + + join('', + $self->SUPER::dist_test(@_), + "\n\n# --- Distar section:\n\n", + (map "$_ = $vars{$_}\n", sort keys %vars), + <<'END', -END - $dist_test .= <<'END'; preflight: - $(ABSPERLRUN) Distar/helpers/preflight $(VERSION) + $(ABSPERLRUN) Distar/helpers/preflight $(VERSION) --changelog=$(CHANGELOG) --branch=$(BRANCH) releasetest: - $(MAKE) disttest RELEASE_TESTING=1 TEST_FILES="$(TEST_FILES)" + $(MAKE) disttest RELEASE_TESTING=1 PASTHRU="$(PASTHRU) TEST_FILES=\"$(TEST_FILES)\"" release: preflight releasetest $(RM_RF) $(DISTVNAME) $(MAKE) $(DISTVNAME).tar$(SUFFIX) @@ -137,34 +160,21 @@ disttest: distmanicheck distmanicheck: create_distdir cd $(DISTVNAME) && $(ABSPERLRUN) "-MExtUtils::Manifest=manicheck" -e "exit manicheck" nextrelease: - $(ABSPERLRUN) Distar/helpers/add-changelog-heading $(VERSION) Changes - GIT_DIFF_OPTS=-u`$(ABSPERLRUN) Distar/helpers/changelog-context $(VERSION) Changes` git add -p Changes + $(ABSPERLRUN) Distar/helpers/add-changelog-heading --git $(VERSION) $(CHANGELOG) refresh: cd Distar && git pull - rm Makefile + $(RM_F) $(FIRST_MAKEFILE) $(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: - \$(ABSPERLRUN) Distar/helpers/bump-version --git \$(VERSION) $arg - \$(RM_F) \$(FIRST_MAKEFILE) - \$(REMAKE) + map(sprintf(<<'END', "bump$_", ($_ || '$(V)')), @bump_targets), +%s: + $(ABSPERLRUN) Distar/helpers/bump-version --git $(VERSION) %s + $(RM_F) $(FIRST_MAKEFILE) + $(REMAKE) END - } - } - - $dist_test .= $include . "\n"; - - return $dist_test; + $include, + "\n", + ); } }