sub after_build { my ($self, $opts) = @_; my $build_dir = $opts->{build_root};
my $wd = pushd($build_dir);
unless ( -d 'blib' ) {
my @builders = @{ $self->zilla->plugins_with( -BuildRunner ) };
die "no BuildRunner plugins specified" unless @builders;
$self->log('building the distribution in order to generate documentation for exception classes...');
$_->build for @builders;
die "no blib; failed to build properly?" unless -d 'blib';
}
# This must be run as a separate process because we need to use the new
# Moose we just generated in order to introspect all the exception
# classes.
$self->log('running author/doc-generator...');
my $text = capturex($^X, 'author/doc-generator');
my $file_obj = first { $_->name eq $filename } @{$self->zilla->files};
my $content = $file_obj->content;
my $pos = index($content, "\n\n=for comment insert generated content here");
$file_obj->content(
substr($content, 0, $pos) . "\n\n"
. $text
. substr($content, $pos, -1));
$filename->spew_raw($file_obj->encoded_content);
}
1;