| Module-Setup documentation | Contained in the Module-Setup distribution. |
Module::Setup::Plugin - Module::Setup Plugin
config setup Module::Setup::Plugin::Config::Basic
module attribute setup Module::Setup::Plugin::VC::SVN
template parameters setup
add module template file for new module Module::Setup::Plugin::VC::Git
for template process Module::Setup::Plugin::Template
for distribute path rewrite phase
for test L<Module::Setup::Plugin::Test::Makefile>
after create_skeleton
last trigger of run method on skeleton directory
last hook of run method Module::Setup::Plugin::VC::SVK
~/.module-setup/flavor/myflavor/plugins/plugin.pm package MyFlavor::Plugin; use strict; use warnings; use base 'Module::Setup::Plugin';
sub register {
my($self, ) = @_;
$self->add_trigger( check_skeleton_directory => \&check_skeleton_directory );
}
sub check_skeleton_directory {
my $self = shift;
}
~/.module-setup/flavor/myflavor/config.yaml
config:
plugins:
- Config::Basic
- VC::SVN
- Template
- Test::Makefile
- +MyFlavor::Plugin
or command option
$ module-setup --plugin=+MyFlavor::Plugin New::Module
| Module-Setup documentation | Contained in the Module-Setup distribution. |
package Module::Setup::Plugin; use strict; use warnings; use Scalar::Util qw(weaken); use Module::Setup::Flavor; use Module::Setup::Path::Dir; sub new { my($class, %args) = @_; my $self = bless { %args }, $class; weaken $self->{context}; $self->register; $self; } sub register {} sub add_trigger { my($self, @args) = @_; $self->{context}->add_trigger(@args); } sub append_template_file { my($self, $context, $caller) = @_; $caller = caller unless $caller; my @template = Module::Setup::Flavor::loader($caller); for my $tmpl (@template) { if (exists $tmpl->{dir}) { Module::Setup::Path::Dir->new($context->distribute->dist_path, split('/', $tmpl->{dir}))->mkpath; next; } elsif (!exists $tmpl->{file}) { next; } my $options = { dist_path => $context->distribute->dist_path->file(split('/', $tmpl->{file})), template => $tmpl->{template}, vars => $context->distribute->template_vars, content => undef, }; $options->{chmod} = $tmpl->{chmod} if $tmpl->{chmod}; $context->distribute->write_template($context, $options); } } 1; __END__