lib/Dist/Zilla/Plugin/JSAN/Minter.pm

filter: Statementstmt 23.3% 7 / 30 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod n/a totaltotal 22.2% 10 / 45 CC 5 SCAR 17.8
CC
5
Cov
18%
exclude_file
12.0
prune_files
6.0
munge_file
6.0
CRAP 5.9
« lib/Dist/Zilla/Plugin/JSAN/NPM.pm ↑ Summary lib/Dist/Zilla/Plugin/JSAN/NPM/Publish.pm »
1 package Dist::Zilla::Plugin::JSAN::Minter;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Dist::Zilla::Plugin::JSAN::Minter::VERSION = '0.06';
4 }
5  
6 # ABSTRACT: Default "minter"
7  
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 extends 'Dist::Zilla::Plugin::JSAN::GatherDir::Template';
11  
12 with 'Dist::Zilla::Role::FilePruner';
13 with 'Dist::Zilla::Role::FileMunger';
14  
15  
16 has 'include_dotfiles' => (
17 is => 'rw',
18 default => 1
19 );
20  
21  
22 0 ▶sub exclude_file {
Subroutine exclude_file: not called CC=3 SCAR=24.8
23 0 my ($self, $file) = @_;
24  
25 0 my $main_perl_moudule = $self->zilla->name;
26 0 $main_perl_moudule =~ s|-|/|g;
27  
28 0 ▶ return 1 if $file->name eq "lib/$main_perl_moudule.pm";
Branch: 1 branch
BranchTrueFalseTotal
if $file->name eq "lib/$main_perl_moudule.pm" 0 0 0
29 0 ▶ return 1 if $file->name eq 'profile.ini';
Branch: 1 branch
BranchTrueFalseTotal
if $file->name eq "profile.ini" 0 0 0
30
31 0 return 0;
32 }
33  
34  
35 0 ▶sub prune_files {
Subroutine prune_files: not called CC=2 SCAR=17.9
36 0 my ($self) = @_;
37  
38 0 my $files = $self->zilla->files;
39  
40 @$files = grep {
41 0 ▶ $self->exclude_file($_) ? do { $self->log_debug([ 'pruning %s', $_->name ]); 0 } : 1
Branch: 1 branch
BranchTrueFalseTotal
$self->exclude_file($_) ? : 0 0 0
42 } @$files;
43  
44 0 return;
45 }
46  
47  
48 0 ▶sub dist_name {
Subroutine dist_name: not called CC=1 SCAR=6.9
49 0 my ($self) = @_;
50
51 0 my $name = $self->zilla->name;
52
53 0 $name =~ s/-/\./g;
54
55 0 return $name;
56 }
57  
58  
59 0 ▶sub munge_file {
Subroutine munge_file: not called CC=2 SCAR=17.9
60 0 my ($self, $file) = @_;
61
62 0 ▶ return unless $file->name =~ m|^lib/Module/Stub\.(.+)$|;
Branch: 1 branch
BranchTrueFalseTotal
unless $file->name =~ m[^lib/Module/Stub\.(.+)$] 0 0 0
63
64 0 my $ext = $1;
65 0 my $name = $self->zilla->name;
66
67 0 $name =~ s|-|/|g;
68
69
70 0 $file->name("lib/$name.$ext")
71 }
72  
73  
74 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
75 __PACKAGE__->meta->make_immutable();
76  
77  
78 1;
79  
80  
81  
82  
83 __END__
« lib/Dist/Zilla/Plugin/JSAN/NPM.pm ↑ Summary lib/Dist/Zilla/Plugin/JSAN/NPM/Publish.pm »