Commit | Line | Data |
ef5454ec |
1 | package inc::Clean; |
2 | use Moose; |
3 | |
4 | with 'Dist::Zilla::Role::BeforeBuild'; |
5 | |
6 | sub before_build { |
7 | my $self = shift; |
8 | |
9 | if (-e 'Makefile') { |
10 | $self->log("Running make distclean to clear out build cruft"); |
1f0403d7 |
11 | unless (fork) { |
12 | close(STDIN); |
13 | close(STDOUT); |
14 | close(STDERR); |
15 | { exec("$^X Makefile.PL && make distclean") } |
16 | die "couldn't exec: $!"; |
17 | } |
ef5454ec |
18 | } |
19 | |
20 | if (-e 'META.yml') { |
21 | $self->log("Removing existing META.yml file"); |
22 | unlink('META.yml'); |
23 | } |
24 | } |