use ExtUtils::MakeMaker ();
use ExtUtils::MM ();
use File::Spec ();
+use File::Basename ();
-our $VERSION = '0.002000';
+our $VERSION = '0.003000';
$VERSION = eval $VERSION;
my $MM_VER = eval $ExtUtils::MakeMaker::VERSION;
sub import {
strict->import;
warnings->import(FATAL => 'all');
- shift->export_to_level(1,@_);
+ if (!(@MM::ISA == 1 && $MM::ISA[0] eq 'Distar::MM')) {
+ @Distar::MM::ISA = @MM::ISA;
+ @MM::ISA = qw(Distar::MM);
+ }
+ goto &Exporter::import;
}
sub author {
{
package Distar::MM;
- our @ISA = @MM::ISA;
- @MM::ISA = (__PACKAGE__);
sub new {
my ($class, $args) = @_;
my @bump_targets =
grep { $include !~ /^bump$_(?: +\w+)*:/m } ('', 'minor', 'major');
- my $distar = File::Spec->catdir(
- File::Spec->catpath((File::Spec->splitpath(__FILE__))[0,1], ''),
- File::Spec->updir,
- );
- my $helpers = File::Spec->catdir($distar, 'helpers');
+ my $distar_lib = File::Basename::dirname(__FILE__);
+ my $helpers = File::Spec->catdir($distar_lib, File::Spec->updir, 'helpers');
my $licenses = $self->{LICENSE} || $self->{META_ADD}{license} || $self->{META_MERGE}{license};
my $authors = $self->{AUTHOR};
for $licenses, $authors;
my %vars = (
- DISTAR => $self->quote_literal($distar),
+ DISTAR_LIB => $self->quote_literal($distar_lib),
HELPERS => $self->quote_literal($helpers),
- REMAKE => join(' ', '$(PERLRUN)', '-I$(DISTAR)/lib', '-mDistar', '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 : ''),
DISTTEST_MAKEFILE_PARAMS => '',
AUTHORS => $self->quote_literal(join(', ', @$authors)),
LICENSES => join(' ', map $self->quote_literal($_), @$licenses),
+ GET_CHANGELOG => '$(ABSPERLRUN) $(HELPERS)/get-changelog $(VERSION) $(CHANGELOG)',
+ UPDATE_DISTAR => (
+ -e File::Spec->catdir($distar_lib, File::Spec->updir, '.git')
+ ? 'git -C $(DISTAR_LIB) pull'
+ : '$(ECHO) "Distar code is not in a git repo, unable to update!"'
+ ),
);
my $dist_test = $self->SUPER::dist_test(@_);
$(MAKE) disttest RELEASE_TESTING=1 DISTTEST_MAKEFILE_PARAMS="PREREQ_FATAL=1" PASTHRU="$(PASTHRU) TEST_FILES=\"$(TEST_FILES)\""
release: preflight
$(MAKE) releasetest
- git commit -a -m "Release commit for $(VERSION)"
- git tag v$(VERSION) -m "release v$(VERSION)"
+ $(GET_CHANGELOG) -p"Release commit for $(VERSION)" | git commit -a -F -
+ $(GET_CHANGELOG) -p"release v$(VERSION)" | git tag -a -F - "v$(VERSION)"
$(RM_RF) $(DISTVNAME)
$(MAKE) $(DISTVNAME).tar$(SUFFIX)
$(NOECHO) $(MAKE) pushrelease FAKE_RELEASE=$(FAKE_RELEASE)
$(DISTVNAME)/LICENSE: Makefile.PL
$(NOECHO) $(MKPATH) $(DISTVNAME)
$(ABSPERLRUN) $(HELPERS)/generate-license $(AUTHORS) $(LICENSES) >$(DISTVNAME)/LICENSE
- $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) ../Distar/helpers/add-to-manifest LICENSE
$(NOECHO) $(ABSPERLRUN) $(HELPERS)/add-to-manifest -d $(DISTVNAME) LICENSE
disttest: distmanicheck
distmanicheck: create_distdir
nextrelease:
$(ABSPERLRUN) $(HELPERS)/add-changelog-heading --git $(VERSION) $(CHANGELOG)
refresh:
- cd $(DISTAR) && git pull || $(TRUE)
+ $(UPDATE_DISTAR)
$(RM_F) $(FIRST_MAKEFILE)
$(REMAKE)
END