lib/Dist/Zilla/Plugin/JSAN/GatherDir/Template.pm

filter: Statementstmt 80.0% 8 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 85.7% 12 / 14 CC 1 SCAR 0.7
CC
1
Cov
80%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/Dist/Zilla/Plugin/JSAN/Shotenjin.pm ↑ Summary
1 package Dist::Zilla::Plugin::JSAN::GatherDir::Template;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Dist::Zilla::Plugin::JSAN::GatherDir::Template::VERSION = '0.06';
4 }
5 # ABSTRACT: gather all the files in a directory and use them as templates (copy-pasted from Dist::Zilla::Plugin::GatherDir::Template with bug-fix)
6  
7 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 extends 'Dist::Zilla::Plugin::GatherDir';
10 with 'Dist::Zilla::Role::TextTemplate';
11  
12 1 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 0 ▶use Moose::Autobox;
Subroutine BEGIN: called CC=1 SCAR=2.6
14 use Dist::Zilla::File::FromCode;
15 use namespace::autoclean;
16  
17  
18 sub _file_from_filename {
19 my ($self, $filename) = @_;
20  
21 my $template = do {
22 open my $fh, '<', $filename;
23 local $/;
24 <$fh>;
25 };
26  
27 return Dist::Zilla::File::FromCode->new({
28 name => $filename,
29 mode => (stat $filename)[2] & 0755 | 0600, # kill world-writeability and add self-writeability
30 code => sub {
31 my ($file_obj) = @_;
32 $self->fill_in_string(
33 $template,
34 {
35 dist => \($self->zilla),
36 plugin => \($self),
37 },
38 );
39 },
40 });
41 }
42  
43 __PACKAGE__->meta->make_immutable;
44 no Moose;
45 1;
46  
47 __END__
« lib/Dist/Zilla/Plugin/JSAN/Shotenjin.pm ↑ Summary