File Coverage

blib/lib/Dist/Zilla/Plugin/License.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::License 6.030;
2             # ABSTRACT: output a LICENSE file
3              
4 9     9   6465 use Moose;
  9         37  
  9         71  
5             with 'Dist::Zilla::Role::FileGatherer';
6              
7 9     9   63037 use Dist::Zilla::Pragmas;
  9         24  
  9         78  
8              
9 9     9   74 use namespace::autoclean;
  9         28  
  9         100  
10              
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod This plugin adds a F<LICENSE> file containing the full text of the
14             #pod distribution's license, as produced by the C<fulltext> method of the
15             #pod dist's L<Software::License> object.
16             #pod
17             #pod =attr filename
18             #pod
19             #pod This attribute can be used to specify a name other than F<LICENSE> to be used.
20             #pod
21             #pod =cut
22              
23 9     9   3467 use Dist::Zilla::File::InMemory;
  9         33  
  9         1753  
24              
25             has filename => (
26             is => 'ro',
27             isa => 'Str',
28             default => 'LICENSE',
29             );
30              
31             sub gather_files {
32 9     9 0 36 my ($self, $arg) = @_;
33              
34 9         368 my $file = Dist::Zilla::File::InMemory->new({
35             name => $self->filename,
36             content => $self->zilla->license->fulltext,
37             });
38              
39 9         79 $self->add_file($file);
40 9         96 return;
41             }
42              
43             __PACKAGE__->meta->make_immutable;
44             1;
45              
46             #pod =head1 SEE ALSO
47             #pod
48             #pod =over 4
49             #pod
50             #pod =item *
51             #pod
52             #pod the C<license> attribute of the L<Dist::Zilla> object to select the license
53             #pod to use.
54             #pod
55             #pod =item *
56             #pod
57             #pod Dist::Zilla roles:
58             #pod L<FileGatherer|Dist::Zilla::Role::FileGatherer>.
59             #pod
60             #pod =item *
61             #pod
62             #pod Other modules:
63             #pod L<Software::License>,
64             #pod L<Software::License::Artistic_2_0>.
65             #pod
66             #pod =back
67             #pod
68             #pod =cut
69              
70             __END__
71              
72             =pod
73              
74             =encoding UTF-8
75              
76             =head1 NAME
77              
78             Dist::Zilla::Plugin::License - output a LICENSE file
79              
80             =head1 VERSION
81              
82             version 6.030
83              
84             =head1 DESCRIPTION
85              
86             This plugin adds a F<LICENSE> file containing the full text of the
87             distribution's license, as produced by the C<fulltext> method of the
88             dist's L<Software::License> object.
89              
90             =head1 PERL VERSION
91              
92             This module should work on any version of perl still receiving updates from
93             the Perl 5 Porters. This means it should work on any version of perl released
94             in the last two to three years. (That is, if the most recently released
95             version is v5.40, then this module should work on both v5.40 and v5.38.)
96              
97             Although it may work on older versions of perl, no guarantee is made that the
98             minimum required version will not be increased. The version may be increased
99             for any reason, and there is no promise that patches will be accepted to lower
100             the minimum required perl.
101              
102             =head1 ATTRIBUTES
103              
104             =head2 filename
105              
106             This attribute can be used to specify a name other than F<LICENSE> to be used.
107              
108             =head1 SEE ALSO
109              
110             =over 4
111              
112             =item *
113              
114             the C<license> attribute of the L<Dist::Zilla> object to select the license
115             to use.
116              
117             =item *
118              
119             Dist::Zilla roles:
120             L<FileGatherer|Dist::Zilla::Role::FileGatherer>.
121              
122             =item *
123              
124             Other modules:
125             L<Software::License>,
126             L<Software::License::Artistic_2_0>.
127              
128             =back
129              
130             =head1 AUTHOR
131              
132             Ricardo SIGNES 😏 <cpan@semiotic.systems>
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2023 by Ricardo SIGNES.
137              
138             This is free software; you can redistribute it and/or modify it under
139             the same terms as the Perl 5 programming language system itself.
140              
141             =cut