Embra/Plugin/PublishFiles.pm

filter: Statementstmt 100% 42 / 42 Branchbran 57.1% 8 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 90.9% 60 / 66 CC 9 SCAR 10.0
CC
9
Cov
89%
publish_site
4.0
exclude_file
4.0
__ANON__
3.1
CRAP 2.7
« Embra/File.pm ↑ Summary Embra/Plugin/SnippetsToNotes.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package App::Embra::Plugin::PublishFiles;
5 1 $App::Embra::Plugin::PublishFiles::VERSION = '0.001'; # TRIAL
6 # ABSTRACT: write site files into a directory
7  
8 1 ▶use Path::Class qw<>;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13  
14 1 ▶has 'to' => (
Subroutine __ANON__: called CC=3 SCAR=11.4
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 1 1
if scalar @_ > 1 0 1 1
15 1 is => 'ro',
16 required => 1,
17 1 ▶ default => '.',
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine publish_site: called CC=4 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 1 1
18 1 coerce => func( $path_as_str ) { Path::Class::dir( $path_as_str ) },
19 2 );
20 2  
21 2 method publish_site {
22 2 ▶ for my $file ( @{ $self->embra->files } ) {
Branch: 1 branch
BranchTrueFalseTotal
chmod $file->mode, $f or die "could't chmod ${file}: $!" 2 0 2
23 my $f = $self->to->file( $file->name );
24 $f->parent->mkpath;
25 $f->spew( $file->content );
26 1 ▶ chmod $file->mode, $f or die "could't chmod $file: $!";
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine exclude_file: called CC=4 SCAR=14.0
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 3 3
if scalar @_ > 1 0 3 3
27 3 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
if $self->to->subsumes($file->name) 1 2 3
28 2 }
29  
30 method exclude_file( $file ) {
31 1 return 1 if $self->to->subsumes( $file->name );
32 1 return;
33 }
34 1  
35 with 'App::Embra::Role::SitePublisher';
36 with 'App::Embra::Role::FilePruner';
37  
38 1;
39  
40 __END__
« Embra/File.pm ↑ Summary Embra/Plugin/SnippetsToNotes.pm »