clear out build cruft before building
Jesse Luehrs [Thu, 21 Apr 2011 15:28:22 +0000 (10:28 -0500)]
this cleans up the directory from if someone did "perl Makefile.PL"
before running dzil build

dist.ini
inc/Clean.pm [new file with mode: 0644]

index 895dd74..224a884 100644 (file)
--- 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 (file)
index 0000000..ce528b5
--- /dev/null
@@ -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');
+    }
+}