line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::CustomLicense; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
23548
|
$Dist::Zilla::Plugin::CustomLicense::VERSION = '1.0.2'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: setting legal stuff of Dist::Zilla while keeping control |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
16161
|
use Moose; |
|
1
|
|
|
|
|
995921
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::BeforeBuild'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has filename => ( is => 'ro', isa => 'Str', default => 'LEGAL' ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub before_build { |
13
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
14
|
0
|
|
|
|
|
|
$self->zilla()->license()->load_sections_from($self->filename()); |
15
|
0
|
|
|
|
|
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
19
|
1
|
|
|
1
|
|
12687
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Dist::Zilla::Plugin::CustomLicense - setting legal stuff of Dist::Zilla while keeping control |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 1.0.2 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This plugin allows using L<Software::License::Custom> to get software |
36
|
|
|
|
|
|
|
licensing information from a custom file. In other terms, you can |
37
|
|
|
|
|
|
|
specify C<Custom> in the license configuration inside L<dist.ini>: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
name = Foo-Bar |
40
|
|
|
|
|
|
|
abstract = basic Bar for Foo |
41
|
|
|
|
|
|
|
author = A.U. Thor <author@example.com> |
42
|
|
|
|
|
|
|
license = Custom |
43
|
|
|
|
|
|
|
copyright_holder = A.U.Thor |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
By default the custom file |
46
|
|
|
|
|
|
|
is F<LEGAL> in the main directory, but it can be configured with the |
47
|
|
|
|
|
|
|
C<filename> option in the F<dist.ini> configuration file: |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
[CustomLicense] |
50
|
|
|
|
|
|
|
filename = MY-LEGAL-ASPECTS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Unfortunately, as of the handover of L<Software::License::Custom> module it |
53
|
|
|
|
|
|
|
seems that its documentation disappeared; see below |
54
|
|
|
|
|
|
|
for details about how file F<LEGAL> |
55
|
|
|
|
|
|
|
should be written. Most probably you will not want to include this file |
56
|
|
|
|
|
|
|
in the final distro, so you should prune it out like this: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
[PruneFiles] |
59
|
|
|
|
|
|
|
filename = LEGAL |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Of course you have to put any name you decided to call your file with! |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 WRITING THE LICENSE FILE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
The default license file is F<LEGAL> in the main directory. Setting it |
66
|
|
|
|
|
|
|
properly, you should be able to customise some aspects of the licensing |
67
|
|
|
|
|
|
|
messages that would otherwise be difficult to tinker, e.g. adding a note |
68
|
|
|
|
|
|
|
in the notice, setting multiple years for the copyright notice or set multiple |
69
|
|
|
|
|
|
|
authors and/or copyright holders. See the L</COPYRIGHT AND LICENSE> section |
70
|
|
|
|
|
|
|
below for an example of this. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The license file contains different sections. Each section has the |
73
|
|
|
|
|
|
|
following format: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
header line |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
a line that begins and ends with two underscores C<__>. The string |
82
|
|
|
|
|
|
|
between the begin and the end of the line is first depured of any |
83
|
|
|
|
|
|
|
non-word character, then used as the name of the section; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
body |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
a L<Text::Template> (possibly a plain text file) where items to be |
90
|
|
|
|
|
|
|
expanded are enclosed between double braces. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Each section is terminated by the header of the following section or by |
95
|
|
|
|
|
|
|
the end of the file. Example: |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__[ NAME ]__ |
98
|
|
|
|
|
|
|
The Foo-Bar License |
99
|
|
|
|
|
|
|
__URL__ |
100
|
|
|
|
|
|
|
http://www.example.com/foo-bar.txt |
101
|
|
|
|
|
|
|
__[ META_NAME ]__ |
102
|
|
|
|
|
|
|
foo_bar_meta |
103
|
|
|
|
|
|
|
__{ META2_NAME }__ |
104
|
|
|
|
|
|
|
foo_bar_meta2 |
105
|
|
|
|
|
|
|
__[ NOTICE ]__ |
106
|
|
|
|
|
|
|
Copyright (C) 2000-2002 by P.R. Evious |
107
|
|
|
|
|
|
|
Copyright (C) {{$self->year}} by {{$self->holder}}. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software, licensed under {{$self->name}}. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__[ LICENSE ]__ |
112
|
|
|
|
|
|
|
The Foo-Bar License |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Well... this is only some sample text. I'm true... only sample text!!! |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Yes, spanning more lines and more paragraphs. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The different formats for specifying the section name in the example |
119
|
|
|
|
|
|
|
above are only examples, you're invited to use a consistent approach. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The sections that you should include are the following: |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item B<< NAME >> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
The name of the license, suitable for shoving in the middle of a |
128
|
|
|
|
|
|
|
sentence, generally with a leading capitalized "The". |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item B<< URL >> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The URL at which a canonical text of the license can be found, |
133
|
|
|
|
|
|
|
if one is available. If possible, this will point at plain text, |
134
|
|
|
|
|
|
|
but it may point to an HTML resource. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item B<< META_NAME >> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The string that should be used for this license in the CPAN F<META.yml> file, |
139
|
|
|
|
|
|
|
according to the CPAN Meta spec v1. Leave out if there is no known |
140
|
|
|
|
|
|
|
string to use. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item B<< META2_NAME >> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The string that should be used for this license in the CPAN F<META.json> |
145
|
|
|
|
|
|
|
or F<META.yml> file, according to the CPAN Meta spec v2. Leave out |
146
|
|
|
|
|
|
|
if there is no known string to use; in this case, see L<Software::License> |
147
|
|
|
|
|
|
|
to understand what will be used. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item B<< NOTICE >> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
A snippet of text, usually a few lines, indicating the copyright holder |
152
|
|
|
|
|
|
|
and year of copyright, as well as an indication of the license under |
153
|
|
|
|
|
|
|
which the software is distributed. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item B<< LICENSE >> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The full text of the license, including customisation of any part of |
158
|
|
|
|
|
|
|
it (e.g. a translation of some sections). |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=back |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
The explanations in the list above has been munged from the documentation |
163
|
|
|
|
|
|
|
of C<Software::License>. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=begin not_needed |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 before_build |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Method required by L<Dist::Zilla::Role::BeforeBuild> for this plugin to work. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=end not_needed |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Flavio Poletti <polettix@cpan.org> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Copyright (C) 2010, 2011 by Flavio Poletti <polettix@cpan.org>. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This module is free software. You can redistribute it and/or |
183
|
|
|
|
|
|
|
modify it under the terms of the Artistic License 2.0. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
186
|
|
|
|
|
|
|
but without any warranty; without even the implied warranty of |
187
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
__END__ |
193
|
|
|
|
|
|
|
|