| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Software::License; # git description: v0.10-4-g9e7e1ff |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Command-line interface to Software::License |
|
3
|
|
|
|
|
|
|
# KEYWORDS: license licence LICENSE generate distribution build tool |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
44068
|
use Moo 1.001000; |
|
|
3
|
|
|
|
|
28567
|
|
|
|
3
|
|
|
|
|
15
|
|
|
8
|
3
|
|
|
3
|
|
5472
|
use MooX::Options; |
|
|
3
|
|
|
|
|
57597
|
|
|
|
3
|
|
|
|
|
16
|
|
|
9
|
3
|
|
|
3
|
|
161269
|
use File::HomeDir; |
|
|
3
|
|
|
|
|
11837
|
|
|
|
3
|
|
|
|
|
143
|
|
|
10
|
3
|
|
|
3
|
|
822
|
use File::Spec::Functions qw/catfile/; |
|
|
3
|
|
|
|
|
1283
|
|
|
|
3
|
|
|
|
|
171
|
|
|
11
|
3
|
|
|
3
|
|
12
|
use Module::Runtime qw/use_module/; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
17
|
|
|
12
|
3
|
|
|
3
|
|
1225
|
use Software::License; |
|
|
3
|
|
|
|
|
21759
|
|
|
|
3
|
|
|
|
|
76
|
|
|
13
|
3
|
|
|
3
|
|
1177
|
use Config::Any; |
|
|
3
|
|
|
|
|
17945
|
|
|
|
3
|
|
|
|
|
106
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
1246
|
use namespace::autoclean 0.16 -except => [qw/_options_data _options_config/]; |
|
|
3
|
|
|
|
|
20880
|
|
|
|
3
|
|
|
|
|
19
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod software-license --holder 'J. Random Hacker' --license Perl_5 --type notice |
|
20
|
|
|
|
|
|
|
#pod |
|
21
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod This module provides a command-line interface to Software::License. It can be |
|
24
|
|
|
|
|
|
|
#pod used to easily produce license notices to be included in other documents. |
|
25
|
|
|
|
|
|
|
#pod |
|
26
|
|
|
|
|
|
|
#pod All the attributes documented below are available as command-line options |
|
27
|
|
|
|
|
|
|
#pod through L and can also be configured in |
|
28
|
|
|
|
|
|
|
#pod F<$HOME/.software_license.conf> through L. |
|
29
|
|
|
|
|
|
|
#pod |
|
30
|
|
|
|
|
|
|
#pod =cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#pod =attr holder |
|
33
|
|
|
|
|
|
|
#pod |
|
34
|
|
|
|
|
|
|
#pod Name of the license holder. |
|
35
|
|
|
|
|
|
|
#pod |
|
36
|
|
|
|
|
|
|
#pod =cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
option holder => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
required => 1, |
|
41
|
|
|
|
|
|
|
format => 's', |
|
42
|
|
|
|
|
|
|
doc => '', |
|
43
|
|
|
|
|
|
|
); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#pod =attr year |
|
46
|
|
|
|
|
|
|
#pod |
|
47
|
|
|
|
|
|
|
#pod Year to be used in the copyright notice. |
|
48
|
|
|
|
|
|
|
#pod |
|
49
|
|
|
|
|
|
|
#pod =cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
option year => ( |
|
52
|
|
|
|
|
|
|
is => 'ro', |
|
53
|
|
|
|
|
|
|
format => 'i', |
|
54
|
|
|
|
|
|
|
doc => '', |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#pod =attr license |
|
58
|
|
|
|
|
|
|
#pod |
|
59
|
|
|
|
|
|
|
#pod Name of the license to use. Must be the name of a module available under the |
|
60
|
|
|
|
|
|
|
#pod Software::License:: namespace. Defaults to Perl_5. |
|
61
|
|
|
|
|
|
|
#pod |
|
62
|
|
|
|
|
|
|
#pod =cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
option license => ( |
|
65
|
|
|
|
|
|
|
is => 'ro', |
|
66
|
|
|
|
|
|
|
default => 'Perl_5', |
|
67
|
|
|
|
|
|
|
format => 's', |
|
68
|
|
|
|
|
|
|
doc => '', |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#pod =attr type |
|
72
|
|
|
|
|
|
|
#pod |
|
73
|
|
|
|
|
|
|
#pod The type of license notice you'd like to generate. Available values are: |
|
74
|
|
|
|
|
|
|
#pod |
|
75
|
|
|
|
|
|
|
#pod B<* notice> |
|
76
|
|
|
|
|
|
|
#pod |
|
77
|
|
|
|
|
|
|
#pod This method returns a snippet of text, usually a few lines, indicating the |
|
78
|
|
|
|
|
|
|
#pod copyright holder and year of copyright, as well as an indication of the license |
|
79
|
|
|
|
|
|
|
#pod under which the software is distributed. |
|
80
|
|
|
|
|
|
|
#pod |
|
81
|
|
|
|
|
|
|
#pod B<* license> |
|
82
|
|
|
|
|
|
|
#pod |
|
83
|
|
|
|
|
|
|
#pod This method returns the full text of the license. |
|
84
|
|
|
|
|
|
|
#pod |
|
85
|
|
|
|
|
|
|
#pod =for :stopwords fulltext |
|
86
|
|
|
|
|
|
|
#pod |
|
87
|
|
|
|
|
|
|
#pod B<* fulltext> |
|
88
|
|
|
|
|
|
|
#pod |
|
89
|
|
|
|
|
|
|
#pod This method returns the complete text of the license, preceded by the copyright |
|
90
|
|
|
|
|
|
|
#pod notice. |
|
91
|
|
|
|
|
|
|
#pod |
|
92
|
|
|
|
|
|
|
#pod B<* version> |
|
93
|
|
|
|
|
|
|
#pod |
|
94
|
|
|
|
|
|
|
#pod =for :stopwords versioned |
|
95
|
|
|
|
|
|
|
#pod |
|
96
|
|
|
|
|
|
|
#pod This method returns the version of the license. If the license is not |
|
97
|
|
|
|
|
|
|
#pod versioned, this returns nothing. |
|
98
|
|
|
|
|
|
|
#pod |
|
99
|
|
|
|
|
|
|
#pod B<* meta_yml_name> |
|
100
|
|
|
|
|
|
|
#pod |
|
101
|
|
|
|
|
|
|
#pod This method returns the string that should be used for this license in the CPAN |
|
102
|
|
|
|
|
|
|
#pod META.yml file, or nothing if there is no known string to use. |
|
103
|
|
|
|
|
|
|
#pod |
|
104
|
|
|
|
|
|
|
#pod =for Pod::Coverage run |
|
105
|
|
|
|
|
|
|
#pod |
|
106
|
|
|
|
|
|
|
#pod =for Pod::Coverage BUILDARGS |
|
107
|
|
|
|
|
|
|
#pod |
|
108
|
|
|
|
|
|
|
#pod =cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
option type => ( |
|
111
|
|
|
|
|
|
|
is => 'ro', |
|
112
|
|
|
|
|
|
|
default => 'notice', |
|
113
|
|
|
|
|
|
|
format => 's', |
|
114
|
|
|
|
|
|
|
doc => '', |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#pod =attr configfile |
|
118
|
|
|
|
|
|
|
#pod |
|
119
|
|
|
|
|
|
|
#pod Path to the optional configuration file. Defaults to C<$HOME/.software_license.conf>. |
|
120
|
|
|
|
|
|
|
#pod |
|
121
|
|
|
|
|
|
|
#pod =cut |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
option configfile => ( |
|
124
|
|
|
|
|
|
|
is => 'ro', |
|
125
|
|
|
|
|
|
|
default => catfile(File::HomeDir->my_home, '.software_license.conf'), |
|
126
|
|
|
|
|
|
|
format => 's', |
|
127
|
|
|
|
|
|
|
doc => '', |
|
128
|
|
|
|
|
|
|
order => 100, |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
has _software_license => ( |
|
132
|
|
|
|
|
|
|
is => 'ro', |
|
133
|
|
|
|
|
|
|
isa => sub { die "Not a Software::License" if !$_[0]->isa('Software::License') }, |
|
134
|
|
|
|
|
|
|
lazy => 1, |
|
135
|
|
|
|
|
|
|
builder => '_build__software_license', |
|
136
|
|
|
|
|
|
|
handles => { |
|
137
|
|
|
|
|
|
|
notice => 'notice', |
|
138
|
|
|
|
|
|
|
text => 'license', |
|
139
|
|
|
|
|
|
|
fulltext => 'fulltext', |
|
140
|
|
|
|
|
|
|
version => 'version', |
|
141
|
|
|
|
|
|
|
}, |
|
142
|
|
|
|
|
|
|
); |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub _build__software_license { |
|
145
|
7
|
|
|
7
|
|
1293
|
my ($self) = @_; |
|
146
|
7
|
|
|
|
|
8
|
my $class = "Software::License::${\$self->license}"; |
|
|
7
|
|
|
|
|
35
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
7
|
|
|
|
|
27
|
return use_module($class)->new({ |
|
149
|
|
|
|
|
|
|
holder => $self->holder, |
|
150
|
|
|
|
|
|
|
year => $self->year, |
|
151
|
|
|
|
|
|
|
}); |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub BUILDARGS { |
|
155
|
7
|
|
|
7
|
0
|
21955
|
my $class = shift; |
|
156
|
|
|
|
|
|
|
|
|
157
|
7
|
|
|
|
|
14
|
my $args = { @_ }; |
|
158
|
7
|
|
66
|
|
|
40
|
my $configfile = $args->{configfile} || catfile(File::HomeDir->my_home, '.software_license.conf'); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# Handling license as a trailing non-option argument |
|
161
|
7
|
100
|
100
|
|
|
212
|
if (!exists $args->{license} |
|
|
|
|
66
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
162
|
|
|
|
|
|
|
&& scalar @ARGV && $ARGV[-1] !~ m{^--.+=.+} |
|
163
|
|
|
|
|
|
|
&& (!scalar (@_) || $ARGV[-1] ne $_[-1]) |
|
164
|
|
|
|
|
|
|
) { |
|
165
|
4
|
|
|
|
|
7
|
$args->{license} = $ARGV[-1]; |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
7
|
100
|
|
|
|
100
|
if (-e $configfile) { |
|
169
|
2
|
|
|
|
|
18
|
my $conf = Config::Any->load_files({ files => [$configfile], use_ext => 1, flatten_to_hash => 1 })->{ $configfile }; |
|
170
|
2
|
50
|
|
|
|
10955
|
$args = { %{ $conf || {} }, %$args }; |
|
|
2
|
|
|
|
|
12
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
7
|
|
|
|
|
131
|
return $args; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub run { |
|
176
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
177
|
0
|
|
|
|
|
|
my $meth = $self->type; |
|
178
|
0
|
|
|
|
|
|
print $self->_software_license->$meth; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
__END__ |