Skip to content

Instantly share code, notes, and snippets.

@rwstauner
Last active December 14, 2015 05:19
Show Gist options
  • Save rwstauner/5034508 to your computer and use it in GitHub Desktop.
Save rwstauner/5034508 to your computer and use it in GitHub Desktop.
package inc::AlienBuild;
use Moose;
extends 'Dist::Zilla::Plugin::ModuleBuild';
with 'Dist::Zilla::Role::FileGatherer';
sub gather_files {
my ($self) = @_;
my $file = $self->zilla->main_module->name;
# use the on-disk file if there is one
return if $self->zilla->files->grep(sub { $_->name eq $file });
# otherwise generate one
$self->add_file(
Dist::Zilla::File::InMemory->new(
name => $file,
content => 'package Alien::Getty; 1;',
),
);
}
has "+mb_class" => (
default => 'Alien::Base::ModuleBuild',
);
around module_build_args => sub {
my ($orig, $self, @args) = @_;
return {
%{ $self->$orig(@args) },
alien_name => 'name',
alien_repo => {
other => 'stuff',
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment