From: Jesse Luehrs Date: Thu, 21 Apr 2011 15:28:22 +0000 (-0500) Subject: clear out build cruft before building X-Git-Tag: 2.0001~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6ae23e86df645234156edff858a5c30f12c63b0;p=gitmo%2FMoose.git clear out build cruft before building this cleans up the directory from if someone did "perl Makefile.PL" before running dzil build --- diff --git a/dist.ini b/dist.ini index 895dd74..224a884 100644 --- a/dist.ini +++ b/dist.ini @@ -6,6 +6,7 @@ copyright_holder = Infinity Interactive, Inc. version = 2.0000 [=inc::RequireAuthorDeps] +[=inc::Clean] [=inc::GatherDir] [PruneCruft] diff --git a/inc/Clean.pm b/inc/Clean.pm new file mode 100644 index 0000000..ce528b5 --- /dev/null +++ b/inc/Clean.pm @@ -0,0 +1,18 @@ +package inc::Clean; +use Moose; + +with 'Dist::Zilla::Role::BeforeBuild'; + +sub before_build { + my $self = shift; + + if (-e 'Makefile') { + $self->log("Running make distclean to clear out build cruft"); + system("$^X Makefile.PL && make distclean"); + } + + if (-e 'META.yml') { + $self->log("Removing existing META.yml file"); + unlink('META.yml'); + } +}