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 18     18   82 use strict;
  18         31  
  18         525  
3 18     18   83 use warnings;
  18         29  
  18         501  
4 18     18   82 use base 'Module::Setup::Plugin';
  18         32  
  18         1027  
5              
6 18     18   101 use Module::Setup::Path::Template;
  18         74  
  18         4888  
7              
8             sub register {
9 74     74 0 118 my($self, ) = @_;
10 74         329 $self->add_trigger( append_template_file => \&append_template_file );
11             }
12              
13             sub append_template_file {
14 41     41 1 2092 my $self = shift;
15              
16 41         179 my $config = $self->base_dir->flavor->additional->config->load;
17 41         34530 for my $additional ( $self->base_dir->flavor->additional->path->children ) {
18 48 100       13429 next unless $additional->is_dir;
19 6         35 my $name = $additional->dir_list(-1);
20 6 100       105 return unless $self->dialog("Do you install additional template by $name? [yN] ", 'n') =~ /[Yy]/;
21              
22 5         85 my $base_src = Module::Setup::Path::Template->new($self->base_dir->flavor->additional->path, $name);
23 5         22 for my $path ($base_src->find_files) {
24 10         223 $self->distribute->install_template($self, $path, $base_src);
25             }
26 5         564 push @{ $self->distribute->{additionals} }, $config->{$name};
  5         19  
27             }
28             }
29              
30             1;