Dist/Zilla/Plugin/DROLSKY/Role/MaybeFileWriter.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 51 CC 3 SCAR 15.5
CC
3
Cov
0%
_maybe_write_file
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 4.7
1 package Dist::Zilla::Plugin::DROLSKY::Role::MaybeFileWriter;
2  
3 use v5.10;
4  
5 use strict;
6 use warnings;
7 use autodie;
8 use namespace::autoclean;
9  
10 our $VERSION = '1.25';
11  
12 use Carp::Always;
13 use Path::Tiny qw( path );
14  
15 use Moose::Role;
16  
17 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
18 sub _maybe_write_file {
19 my $self = shift;
20 my $path = shift;
21 my $content = shift;
22 my $is_executable = shift;
23  
24 my $file = path($path);
25  
26 return if $file->exists;
27  
28 ## no critic (ValuesAndExpressions::ProhibitLeadingZeros )
29 $file->parent->mkdir( { chmod => 0755 } );
30 $file->spew_utf8($content);
31 $file->chmod(0755) if $is_executable;
32  
33 return;
34 }
35  
36 1;
37  
38 # ABSTRACT: Knows how to maybe write files
39  
40 __END__