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

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 89.4% 34 / 38 CC 2 SCAR 2.6
CC
2
Cov
97%
munge_files
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm ↑ Summary blib/lib/Dist/Zilla/Pragmas.pm »
1 package Dist::Zilla::Plugin::Readme 6.040;
2 # ABSTRACT: build a README file
3  
4 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 with qw/Dist::Zilla::Role::FileGatherer
6 Dist::Zilla::Role::TextTemplate
7 Dist::Zilla::Role::FileMunger/;
8  
9 9 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 9 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #pod =head1 DESCRIPTION
15 #pod
16 #pod This plugin adds a very simple F<README> file to the distribution, citing the
17 #pod dist's name, version, abstract, and license. It may be more useful or
18 #pod informative in the future.
19 #pod
20 #pod =cut
21  
22 9 has _file_obj => (
23 is => 'rw', isa => role_type('Dist::Zilla::Role::File'),
24 );
25  
26 9 ▶sub gather_files {
Subroutine gather_files: called CC=1 SCAR=0.0
Pod undocumented
27 9 my ($self, $arg) = @_;
28  
29 9 require Dist::Zilla::File::InMemory;
30  
31 9 my $template = q|
32  
33 This archive contains the distribution {{ $dist->name }},
34 version {{ $dist->version }}:
35  
36 {{ $dist->abstract }}
37  
38 {{ $dist->license->notice }}
39  
40 This README file was generated by {{ $generated_by }}.
41  
42 |;
43 9 $template =~ s/\A\n+//;
44 9 $template =~ s/\n+\z/\n/;
45  
46 9 $self->add_file(
47 $self->_file_obj(
48 Dist::Zilla::File::InMemory->new(
49 name => 'README',
50 content => $template,
51 )
52 )
53 );
54  
55 9 return;
56 }
57  
58 9 ▶sub munge_files {
Subroutine munge_files: called CC=2 SCAR=7.0
Pod undocumented
59 9 my $self = shift;
60  
61 9 my $file = $self->_file_obj;
62  
63 9 ▶ $file->content(
Condition50%1/2
$self->VERSION || '(dev)'
l!l
90
MC/DC0%0/1
$self->VERSION || '(dev)'
$self->VERSION
Truth table50%1/2
A
A= $self->VERSION
Aresult
11
00
64 $self->fill_in_string(
65 $file->content,
66 {
67 dist => \($self->zilla),
68 generated_by => \sprintf("%s v%s",
69 ref($self), $self->VERSION || '(dev)'),
70 }
71 )
72 );
73  
74 9 return;
75 }
76  
77 9 __PACKAGE__->meta->make_immutable;
78 9 1;
79  
80 __END__
« blib/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm ↑ Summary blib/lib/Dist/Zilla/Pragmas.pm »