blib/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm

filter: Statementstmt 70.2% 26 / 37 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 68.7% 33 / 48 CC 3 SCAR 8.9
CC
3
Cov
72%
find_files
6.0
__ANON__
2.0
share_dir_map
2.0
CRAP 2.4
« blib/lib/Dist/Zilla/MintingProfile/Default.pm ↑ Summary blib/lib/Dist/Zilla/Chrome/Test.pm »
1 package Dist::Zilla::Plugin::ModuleShareDirs 6.040;
2 # ABSTRACT: install a directory's contents as module-based "ShareDir" content
3  
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #pod =head1 SYNOPSIS
11 #pod
12 #pod In your F<dist.ini>:
13 #pod
14 #pod [ModuleShareDirs]
15 #pod Foo::Bar = shares/foo_bar
16 #pod Foo::Baz = shares/foo_baz
17 #pod
18 #pod =cut
19  
20 has _module_map => (
21 is => 'ro',
22 isa => 'HashRef',
23 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 2 );
25  
26 0 ▶sub find_files {
Subroutine find_files: not called CC=2 SCAR=17.9
Pod undocumented
27 0 my ($self) = @_;
28 0 my $modmap = $self->_module_map;
29 0 my @files;
30  
31 0 for my $mod ( keys %$modmap ) {
32 0 my $dir = $modmap->{$mod};
33 0 my @mod_files = grep { index($_->name, "$dir/") == 0 }
34 0 @{ $self->zilla->files };
35 0 push @files, @mod_files;
36 }
37  
38 0 return \@files;
39 }
40  
41 7 ▶sub share_dir_map {
Subroutine share_dir_map: called CC=2 SCAR=6.9
Pod undocumented
42 7 my ($self) = @_;
43 7 my $modmap = $self->_module_map;
44  
45 7 ▶ return unless keys %$modmap;
Branch: 1 branch
BranchTrueFalseTotal
unless keys %$modmap 2 5 7
46 5 return { module => $modmap };
47 }
48  
49 7 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
50 7 my $orig = shift;
51 7 my ($class, @arg) = @_;
52  
53 7 my $args = $class->$orig(@arg);
54 7 my %copy = %{ $args };
55  
56 7 my $zilla = delete $copy{zilla};
57 7 my $name = delete $copy{plugin_name};
58  
59 return {
60 7 zilla => $zilla,
61 plugin_name => $name,
62 _module_map => \%copy,
63 }
64 2 };
65  
66 2 with 'Dist::Zilla::Role::ShareDir';
67 2 __PACKAGE__->meta->make_immutable;
68 2 1;
69  
70 __END__
« blib/lib/Dist/Zilla/MintingProfile/Default.pm ↑ Summary blib/lib/Dist/Zilla/Chrome/Test.pm »