File Coverage

lib/XT/Files/Plugin/Default.pm
Criterion Covered Total %
statement 32 32 100.0
branch 8 8 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 46 46 100.0


line stmt bran cond sub pod time code
1             package XT::Files::Plugin::Default;
2              
3 6     6   3405 use 5.006;
  6         18  
4 6     6   35 use strict;
  6         11  
  6         130  
5 6     6   30 use warnings;
  6         11  
  6         318  
6              
7             our $VERSION = '0.002';
8              
9 6     6   2811 use parent 'XT::Files::Plugin';
  6         2053  
  6         34  
10              
11             sub run {
12 7     7 1 3455 my ( $self, $args ) = @_;
13              
14 7         13 my $dirs = 1;
15 7         13 my $excludes = 1;
16              
17             ARG:
18 7         11 for my $arg ( @{$args} ) {
  7         17  
19 4         6 my ( $key, $value ) = @{$arg};
  4         10  
20              
21 4 100       13 if ( $key eq 'dirs' ) {
22 2         3 $dirs = !!$value;
23 2         6 next ARG;
24             }
25              
26 2 100       6 if ( $key eq 'excludes' ) {
27 1         2 $excludes = !!$value;
28 1         3 next ARG;
29             }
30              
31 1         12 $self->log_fatal("Invalid configuration option '$key = $value' for plugin 'Default'");
32             }
33              
34 6         115 my $xtf = $self->xtf;
35              
36 6 100       59 if ($excludes) {
37 5         14 $xtf->plugin( 'Excludes', undef, [ map { [ 'exclude' => $_ ] } (qw([.]swp$ [.]bak$ ~$)) ] );
  15         52  
38             }
39              
40 6 100       94 if ($dirs) {
41 4         20 $xtf->plugin(
42             'Dirs', undef,
43             [
44             [ bin => 'bin' ],
45             [ bin => 'script' ],
46             [ module => 'lib' ],
47             ],
48             );
49             }
50              
51 6         82 return;
52             }
53              
54             1;
55              
56             __END__