File Coverage

blib/lib/Module/Setup/Plugin/Additional.pm
Criterion Covered Total %
statement 25 25 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 1 2 50.0
total 36 37 97.3


line stmt bran cond sub pod time code
1             package Module::Setup::Plugin::Additional;
2 21     21   127 use strict;
  21         55  
  21         773  
3 21     21   127 use warnings;
  21         52  
  21         574  
4 21     21   198 use base 'Module::Setup::Plugin';
  21         245  
  21         1569  
5              
6 21     21   205 use Module::Setup::Path::Template;
  21         86  
  21         12453  
7              
8             sub register {
9 80     80 0 299 my($self, ) = @_;
10 80         482 $self->add_trigger( append_template_file => \&append_template_file );
11             }
12              
13             sub append_template_file {
14 44     44 1 2356 my $self = shift;
15              
16 44         266 my $config = $self->base_dir->flavor->additional->config->load;
17 44         52076 for my $additional ( $self->base_dir->flavor->additional->path->children ) {
18 51 100       8337 next unless $additional->is_dir;
19 6         46 my $name = $additional->dir_list(-1);
20 6 100       116 return unless $self->dialog("Do you install additional template by $name? [yN] ", 'n') =~ /[Yy]/;
21              
22 5         109 my $base_src = Module::Setup::Path::Template->new($self->base_dir->flavor->additional->path, $name);
23 5         24 for my $path ($base_src->find_files) {
24 10         81 $self->distribute->install_template($self, $path, $base_src);
25             }
26 5         47 push @{ $self->distribute->{additionals} }, $config->{$name};
  5         21  
27             }
28             }
29              
30             1;