license_finder-rubyzip3 7.2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.force-build +0 -0
- data/.github/dependabot.yml +16 -0
- data/.gitignore +13 -0
- data/.pre-commit-hooks.yaml +10 -0
- data/.rspec +1 -0
- data/.rubocop.yml +84 -0
- data/CHANGELOG.md +1066 -0
- data/CONTRIBUTING.md +122 -0
- data/Dockerfile +275 -0
- data/Gemfile +2 -0
- data/LICENSE +22 -0
- data/README.md +597 -0
- data/Rakefile +77 -0
- data/TODO.md +12 -0
- data/VERSION +1 -0
- data/appveyor.yml +21 -0
- data/bin/license_finder +6 -0
- data/bin/license_finder_pip.py +43 -0
- data/ci/pipelines/pull-request.yml.erb +138 -0
- data/ci/pipelines/release.yml.erb +176 -0
- data/ci/scripts/containerize-tests.sh +14 -0
- data/ci/scripts/pushscript.sh +31 -0
- data/ci/scripts/run-rubocop.sh +15 -0
- data/ci/scripts/run-tests.sh +41 -0
- data/ci/scripts/test.ps1 +81 -0
- data/ci/scripts/updateChangelog.sh +84 -0
- data/ci/tasks/build-and-push-gem.yml +10 -0
- data/ci/tasks/build-windows.yml +6 -0
- data/ci/tasks/build.yml +16 -0
- data/ci/tasks/rubocop.yml +15 -0
- data/ci/tasks/run-tests.yml +10 -0
- data/ci/tasks/update-changelog.yml +18 -0
- data/dlf +21 -0
- data/examples/Gemfile +4 -0
- data/examples/custom_erb_template.rb +24 -0
- data/examples/extract_license_data.rb +63 -0
- data/examples/sample_template.erb +7 -0
- data/lib/license_finder/cli/approvals.rb +28 -0
- data/lib/license_finder/cli/base.rb +113 -0
- data/lib/license_finder/cli/dependencies.rb +44 -0
- data/lib/license_finder/cli/ignored_dependencies.rb +32 -0
- data/lib/license_finder/cli/ignored_groups.rb +32 -0
- data/lib/license_finder/cli/inherited_decisions.rb +50 -0
- data/lib/license_finder/cli/licenses.rb +31 -0
- data/lib/license_finder/cli/main.rb +229 -0
- data/lib/license_finder/cli/makes_decisions.rb +38 -0
- data/lib/license_finder/cli/patched_thor.rb +33 -0
- data/lib/license_finder/cli/permitted_licenses.rb +32 -0
- data/lib/license_finder/cli/project_name.rb +32 -0
- data/lib/license_finder/cli/restricted_licenses.rb +32 -0
- data/lib/license_finder/cli.rb +20 -0
- data/lib/license_finder/configuration.rb +197 -0
- data/lib/license_finder/core.rb +121 -0
- data/lib/license_finder/decision_applier.rb +70 -0
- data/lib/license_finder/decisions.rb +334 -0
- data/lib/license_finder/decisions_factory.rb +13 -0
- data/lib/license_finder/diff.rb +51 -0
- data/lib/license_finder/license/any_matcher.rb +15 -0
- data/lib/license_finder/license/definitions.rb +498 -0
- data/lib/license_finder/license/header_matcher.rb +17 -0
- data/lib/license_finder/license/matcher.rb +24 -0
- data/lib/license_finder/license/none_matcher.rb +11 -0
- data/lib/license_finder/license/template.rb +19 -0
- data/lib/license_finder/license/templates/0BSD.txt +10 -0
- data/lib/license_finder/license/templates/AGPL3.txt +661 -0
- data/lib/license_finder/license/templates/Apache1_1.txt +16 -0
- data/lib/license_finder/license/templates/Apache2.txt +170 -0
- data/lib/license_finder/license/templates/Artistic.txt +128 -0
- data/lib/license_finder/license/templates/BSD.txt +24 -0
- data/lib/license_finder/license/templates/CC01.txt +30 -0
- data/lib/license_finder/license/templates/CC01_alt.txt +31 -0
- data/lib/license_finder/license/templates/CDDL1.txt +131 -0
- data/lib/license_finder/license/templates/CDDL1_1.txt +123 -0
- data/lib/license_finder/license/templates/CPL1.txt +217 -0
- data/lib/license_finder/license/templates/EPL1.txt +86 -0
- data/lib/license_finder/license/templates/EPL2.txt +80 -0
- data/lib/license_finder/license/templates/GPLv2.txt +339 -0
- data/lib/license_finder/license/templates/GPLv3.txt +674 -0
- data/lib/license_finder/license/templates/ISC.txt +2 -0
- data/lib/license_finder/license/templates/LGPL.txt +165 -0
- data/lib/license_finder/license/templates/LGPL2_1.txt +169 -0
- data/lib/license_finder/license/templates/MIT.txt +9 -0
- data/lib/license_finder/license/templates/MPL1_1.txt +469 -0
- data/lib/license_finder/license/templates/MPL2.txt +373 -0
- data/lib/license_finder/license/templates/NewBSD.txt +21 -0
- data/lib/license_finder/license/templates/OFL.txt +91 -0
- data/lib/license_finder/license/templates/Python.txt +47 -0
- data/lib/license_finder/license/templates/Ruby.txt +52 -0
- data/lib/license_finder/license/templates/SimplifiedBSD.txt +19 -0
- data/lib/license_finder/license/templates/Unlicense.txt +24 -0
- data/lib/license_finder/license/templates/WTFPL.txt +14 -0
- data/lib/license_finder/license/templates/Zlib.txt +17 -0
- data/lib/license_finder/license/text.rb +49 -0
- data/lib/license_finder/license.rb +123 -0
- data/lib/license_finder/license_aggregator.rb +59 -0
- data/lib/license_finder/logger.rb +69 -0
- data/lib/license_finder/manual_licenses.rb +79 -0
- data/lib/license_finder/package.rb +195 -0
- data/lib/license_finder/package_delta.rb +61 -0
- data/lib/license_finder/package_manager.rb +183 -0
- data/lib/license_finder/package_managers/bower.rb +37 -0
- data/lib/license_finder/package_managers/bundler.rb +110 -0
- data/lib/license_finder/package_managers/cargo.rb +38 -0
- data/lib/license_finder/package_managers/carthage.rb +68 -0
- data/lib/license_finder/package_managers/cocoa_pods.rb +66 -0
- data/lib/license_finder/package_managers/composer.rb +63 -0
- data/lib/license_finder/package_managers/conan.rb +70 -0
- data/lib/license_finder/package_managers/conda.rb +131 -0
- data/lib/license_finder/package_managers/dep.rb +45 -0
- data/lib/license_finder/package_managers/dotnet.rb +86 -0
- data/lib/license_finder/package_managers/erlangmk.rb +50 -0
- data/lib/license_finder/package_managers/glide.rb +42 -0
- data/lib/license_finder/package_managers/go_15vendorexperiment.rb +87 -0
- data/lib/license_finder/package_managers/go_dep.rb +80 -0
- data/lib/license_finder/package_managers/go_modules.rb +93 -0
- data/lib/license_finder/package_managers/go_workspace.rb +117 -0
- data/lib/license_finder/package_managers/govendor.rb +73 -0
- data/lib/license_finder/package_managers/gradle.rb +99 -0
- data/lib/license_finder/package_managers/gvt.rb +69 -0
- data/lib/license_finder/package_managers/maven.rb +69 -0
- data/lib/license_finder/package_managers/mix.rb +131 -0
- data/lib/license_finder/package_managers/npm.rb +70 -0
- data/lib/license_finder/package_managers/nuget.rb +159 -0
- data/lib/license_finder/package_managers/pip.rb +70 -0
- data/lib/license_finder/package_managers/pipenv.rb +63 -0
- data/lib/license_finder/package_managers/pnpm.rb +126 -0
- data/lib/license_finder/package_managers/pub.rb +86 -0
- data/lib/license_finder/package_managers/rebar.rb +65 -0
- data/lib/license_finder/package_managers/sbt.rb +46 -0
- data/lib/license_finder/package_managers/spm.rb +93 -0
- data/lib/license_finder/package_managers/trash.rb +43 -0
- data/lib/license_finder/package_managers/yarn.rb +195 -0
- data/lib/license_finder/package_utils/activation.rb +40 -0
- data/lib/license_finder/package_utils/conan_info_parser.rb +77 -0
- data/lib/license_finder/package_utils/conan_info_parser_v2.rb +82 -0
- data/lib/license_finder/package_utils/gradle_dependency_finder.rb +15 -0
- data/lib/license_finder/package_utils/license_files.rb +51 -0
- data/lib/license_finder/package_utils/licensing.rb +40 -0
- data/lib/license_finder/package_utils/maven_dependency_finder.rb +57 -0
- data/lib/license_finder/package_utils/notice_files.rb +51 -0
- data/lib/license_finder/package_utils/possible_license_file.rb +33 -0
- data/lib/license_finder/package_utils/pypi.rb +43 -0
- data/lib/license_finder/package_utils/sbt_dependency_finder.rb +15 -0
- data/lib/license_finder/packages/bower_package.rb +45 -0
- data/lib/license_finder/packages/bundler_package.rb +33 -0
- data/lib/license_finder/packages/cargo_package.rb +28 -0
- data/lib/license_finder/packages/carthage_package.rb +18 -0
- data/lib/license_finder/packages/cocoa_pods_package.rb +22 -0
- data/lib/license_finder/packages/composer_package.rb +13 -0
- data/lib/license_finder/packages/conan_package.rb +23 -0
- data/lib/license_finder/packages/conda_package.rb +74 -0
- data/lib/license_finder/packages/erlangmk_package.rb +112 -0
- data/lib/license_finder/packages/go_package.rb +30 -0
- data/lib/license_finder/packages/gradle_package.rb +30 -0
- data/lib/license_finder/packages/manual_package.rb +27 -0
- data/lib/license_finder/packages/maven_package.rb +39 -0
- data/lib/license_finder/packages/merged_package.rb +44 -0
- data/lib/license_finder/packages/mix_package.rb +13 -0
- data/lib/license_finder/packages/npm_package.rb +219 -0
- data/lib/license_finder/packages/nuget_package.rb +13 -0
- data/lib/license_finder/packages/pip_package.rb +50 -0
- data/lib/license_finder/packages/pnpm_package.rb +13 -0
- data/lib/license_finder/packages/pubspec_package.rb +18 -0
- data/lib/license_finder/packages/rebar_package.rb +13 -0
- data/lib/license_finder/packages/sbt_package.rb +22 -0
- data/lib/license_finder/packages/spm_package.rb +18 -0
- data/lib/license_finder/packages/yarn_package.rb +13 -0
- data/lib/license_finder/platform.rb +15 -0
- data/lib/license_finder/printer.rb +39 -0
- data/lib/license_finder/project_finder.rb +62 -0
- data/lib/license_finder/report.rb +34 -0
- data/lib/license_finder/reports/csv_report.rb +108 -0
- data/lib/license_finder/reports/diff_report.rb +29 -0
- data/lib/license_finder/reports/erb_report.rb +62 -0
- data/lib/license_finder/reports/html_report.rb +13 -0
- data/lib/license_finder/reports/json_report.rb +31 -0
- data/lib/license_finder/reports/junit_report.rb +23 -0
- data/lib/license_finder/reports/markdown_report.rb +9 -0
- data/lib/license_finder/reports/merged_report.rb +16 -0
- data/lib/license_finder/reports/templates/bootstrap.css +9 -0
- data/lib/license_finder/reports/templates/html_report.erb +113 -0
- data/lib/license_finder/reports/templates/junit_report.erb +41 -0
- data/lib/license_finder/reports/templates/markdown_report.erb +49 -0
- data/lib/license_finder/reports/templates/xml_report.erb +19 -0
- data/lib/license_finder/reports/text_report.rb +12 -0
- data/lib/license_finder/reports/xml_report.rb +23 -0
- data/lib/license_finder/scanner.rb +83 -0
- data/lib/license_finder/shared_helpers/cmd.rb +13 -0
- data/lib/license_finder/shared_helpers/common_path.rb +29 -0
- data/lib/license_finder/version.rb +6 -0
- data/lib/license_finder.rb +14 -0
- data/license_finder.gemspec +79 -0
- data/release/instructions.md +8 -0
- data/swift-all-keys.asc +240 -0
- metadata +604 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LicenseFinder
|
|
4
|
+
class License
|
|
5
|
+
module Definitions
|
|
6
|
+
extend self
|
|
7
|
+
|
|
8
|
+
def all
|
|
9
|
+
[
|
|
10
|
+
agpl3,
|
|
11
|
+
apache1_1,
|
|
12
|
+
apache2,
|
|
13
|
+
artistic,
|
|
14
|
+
bsd,
|
|
15
|
+
cc01,
|
|
16
|
+
cddl1,
|
|
17
|
+
cddl1_1,
|
|
18
|
+
cpl1,
|
|
19
|
+
eclipse1,
|
|
20
|
+
eclipse2,
|
|
21
|
+
gplv2,
|
|
22
|
+
gplv3,
|
|
23
|
+
isc,
|
|
24
|
+
lgpl,
|
|
25
|
+
lgpl2_1,
|
|
26
|
+
mit,
|
|
27
|
+
mpl1_1,
|
|
28
|
+
mpl2,
|
|
29
|
+
newbsd,
|
|
30
|
+
ofl,
|
|
31
|
+
python,
|
|
32
|
+
ruby,
|
|
33
|
+
simplifiedbsd,
|
|
34
|
+
unlicense,
|
|
35
|
+
wtfpl,
|
|
36
|
+
zerobsd,
|
|
37
|
+
zlib
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def build_unrecognized(name)
|
|
42
|
+
License.new(
|
|
43
|
+
short_name: name,
|
|
44
|
+
url: nil,
|
|
45
|
+
matcher: NoneMatcher.new
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def agpl3
|
|
52
|
+
License.new(
|
|
53
|
+
short_name: 'AGPL3',
|
|
54
|
+
spdx_id: 'AGPL-3.0-only',
|
|
55
|
+
pretty_name: 'GNU Affero GPL',
|
|
56
|
+
other_names: [
|
|
57
|
+
'AGPL 3',
|
|
58
|
+
'AGPL-3.0',
|
|
59
|
+
'AGPL 3.0',
|
|
60
|
+
'GNU Affero General Public License v3.0',
|
|
61
|
+
'GNU Affero General Public License, Version 3'
|
|
62
|
+
],
|
|
63
|
+
url: 'http://www.gnu.org/licenses/agpl-3.0.html'
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def apache1_1
|
|
68
|
+
License.new(
|
|
69
|
+
short_name: 'Apache1_1',
|
|
70
|
+
spdx_id: 'Apache-1.1',
|
|
71
|
+
pretty_name: 'Apache 1.1',
|
|
72
|
+
other_names: [
|
|
73
|
+
'Apache',
|
|
74
|
+
'Apache-1.1',
|
|
75
|
+
'APACHE 1.1',
|
|
76
|
+
'Apache License 1.1',
|
|
77
|
+
'Apache License Version 1.1',
|
|
78
|
+
'Apache Public License 1.1',
|
|
79
|
+
'Apache Software License, Version 1.1',
|
|
80
|
+
'Apache Software License - Version 1.1',
|
|
81
|
+
'Apache License, Version 1.1',
|
|
82
|
+
'ASL 1.1',
|
|
83
|
+
'ASF 1.1'
|
|
84
|
+
],
|
|
85
|
+
url: 'http://www.apache.org/licenses/LICENSE-1.1.txt'
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def apache2
|
|
90
|
+
License.new(
|
|
91
|
+
short_name: 'Apache2',
|
|
92
|
+
spdx_id: 'Apache-2.0',
|
|
93
|
+
pretty_name: 'Apache 2.0',
|
|
94
|
+
other_names: [
|
|
95
|
+
'Apache Software License',
|
|
96
|
+
'Apache License 2.0',
|
|
97
|
+
'Apache License Version 2.0',
|
|
98
|
+
'Apache Public License 2.0',
|
|
99
|
+
'Apache Software License, Version 2.0',
|
|
100
|
+
'Apache Software License - Version 2.0',
|
|
101
|
+
'Apache 2',
|
|
102
|
+
'Apache License',
|
|
103
|
+
'Apache License, Version 2.0',
|
|
104
|
+
'ASL 2.0',
|
|
105
|
+
'ASF 2.0'
|
|
106
|
+
],
|
|
107
|
+
url: 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def artistic
|
|
112
|
+
License.new(
|
|
113
|
+
short_name: 'Artistic',
|
|
114
|
+
spdx_id: 'Artistic-1.0',
|
|
115
|
+
pretty_name: 'Artistic 1.0',
|
|
116
|
+
other_names: ['Artistic License'],
|
|
117
|
+
url: 'https://www.perlfoundation.org/artistic-license-20.html'
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def bsd
|
|
122
|
+
License.new(
|
|
123
|
+
short_name: 'BSD',
|
|
124
|
+
spdx_id: 'BSD-4-Clause',
|
|
125
|
+
other_names: ['BSD4', 'bsd-old', '4-clause BSD', 'BSD 4-Clause', 'BSD License'],
|
|
126
|
+
url: 'https://directory.fsf.org/wiki/License:BSD-4-Clause'
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def cc01
|
|
131
|
+
License.new(
|
|
132
|
+
short_name: 'CC01',
|
|
133
|
+
spdx_id: 'CC0-1.0',
|
|
134
|
+
pretty_name: 'CC0 1.0 Universal',
|
|
135
|
+
other_names: ['CC0 1.0'],
|
|
136
|
+
matcher: AnyMatcher.new(
|
|
137
|
+
Matcher.from_template(Template.named('CC01')),
|
|
138
|
+
Matcher.from_template(Template.named('CC01_alt'))
|
|
139
|
+
),
|
|
140
|
+
url: 'http://creativecommons.org/publicdomain/zero/1.0'
|
|
141
|
+
)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def cddl1
|
|
145
|
+
License.new(
|
|
146
|
+
short_name: 'CDDL1',
|
|
147
|
+
spdx_id: 'CDDL-1.0',
|
|
148
|
+
pretty_name: 'Common Development and Distribution License 1.0',
|
|
149
|
+
other_names: [
|
|
150
|
+
'CDDL-1.0',
|
|
151
|
+
'Common Development and Distribution License (CDDL) v1.0',
|
|
152
|
+
'COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0'
|
|
153
|
+
],
|
|
154
|
+
url: 'https://spdx.org/licenses/CDDL-1.0.html'
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def cddl1_1
|
|
159
|
+
License.new(
|
|
160
|
+
short_name: 'CDDL1_1',
|
|
161
|
+
spdx_id: 'CDDL-1.1',
|
|
162
|
+
pretty_name: 'Common Development and Distribution License 1.1',
|
|
163
|
+
other_names: [
|
|
164
|
+
'CDDL-1.1',
|
|
165
|
+
'Common Development and Distribution License (CDDL) v1.1',
|
|
166
|
+
'COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1'
|
|
167
|
+
],
|
|
168
|
+
url: 'https://spdx.org/licenses/CDDL-1.1.html'
|
|
169
|
+
)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def cpl1
|
|
173
|
+
License.new(
|
|
174
|
+
short_name: 'CPL1',
|
|
175
|
+
spdx_id: 'CPL-1.0',
|
|
176
|
+
pretty_name: 'Common Public License Version 1.0',
|
|
177
|
+
other_names: [
|
|
178
|
+
'CPL-1',
|
|
179
|
+
'CPL 1',
|
|
180
|
+
'CPL-1.0',
|
|
181
|
+
'CPL 1.0',
|
|
182
|
+
'Common Public License 1.0',
|
|
183
|
+
'Common Public License v1.0',
|
|
184
|
+
'Common Public License, v1.0'
|
|
185
|
+
],
|
|
186
|
+
url: 'https://opensource.org/licenses/cpl1.0.txt'
|
|
187
|
+
)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def eclipse1
|
|
191
|
+
License.new(
|
|
192
|
+
short_name: 'EPL1',
|
|
193
|
+
spdx_id: 'EPL-1.0',
|
|
194
|
+
pretty_name: 'Eclipse Public License 1.0',
|
|
195
|
+
other_names: [
|
|
196
|
+
'EPL 1.0',
|
|
197
|
+
'Eclipse 1.0',
|
|
198
|
+
'Eclipse Public License 1.0',
|
|
199
|
+
'Eclipse Public License - v 1.0'
|
|
200
|
+
],
|
|
201
|
+
url: 'https://www.eclipse.org/legal/epl-v10.html'
|
|
202
|
+
)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def eclipse2
|
|
206
|
+
License.new(
|
|
207
|
+
short_name: 'EPL2',
|
|
208
|
+
spdx_id: 'EPL-2.0',
|
|
209
|
+
pretty_name: 'Eclipse 2.0',
|
|
210
|
+
other_names: [
|
|
211
|
+
'EPL-2.0',
|
|
212
|
+
'EPL 2.0',
|
|
213
|
+
'Eclipse 2.0',
|
|
214
|
+
'Eclipse Public License 2.0',
|
|
215
|
+
'Eclipse Public License - v 2.0'
|
|
216
|
+
],
|
|
217
|
+
url: 'https://www.eclipse.org/legal/epl-v20.html'
|
|
218
|
+
)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def gplv2
|
|
222
|
+
License.new(
|
|
223
|
+
short_name: 'GPLv2',
|
|
224
|
+
spdx_id: 'GPL-2.0-only',
|
|
225
|
+
# pretty_name: 'GPL 2.0',
|
|
226
|
+
other_names: ['GPL V2', 'gpl-v2', 'GNU GENERAL PUBLIC LICENSE Version 2', 'GPL 2.0'],
|
|
227
|
+
url: 'http://www.gnu.org/licenses/gpl-2.0.txt'
|
|
228
|
+
)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def gplv3
|
|
232
|
+
License.new(
|
|
233
|
+
short_name: 'GPLv3',
|
|
234
|
+
spdx_id: 'GPL-3.0-only',
|
|
235
|
+
# pretty_name: 'GPL 3.0',
|
|
236
|
+
other_names: ['GPL V3', 'gpl-v3', 'GNU GENERAL PUBLIC LICENSE Version 3', 'GPL 3.0'],
|
|
237
|
+
url: 'http://www.gnu.org/licenses/gpl-3.0.txt'
|
|
238
|
+
)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def isc
|
|
242
|
+
License.new(
|
|
243
|
+
short_name: 'ISC',
|
|
244
|
+
spdx_id: 'ISC',
|
|
245
|
+
other_names: ['ISC License'],
|
|
246
|
+
url: 'http://en.wikipedia.org/wiki/ISC_license'
|
|
247
|
+
)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def lgpl
|
|
251
|
+
License.new(
|
|
252
|
+
short_name: 'LGPL',
|
|
253
|
+
spdx_id: 'LGPL-3.0-only',
|
|
254
|
+
# pretty_name: 'LGPL 3.0',
|
|
255
|
+
other_names: ['LGPL-3', 'LGPLv3', 'LGPL-3.0', 'LGPL 3.0'],
|
|
256
|
+
url: 'http://www.gnu.org/licenses/lgpl.txt'
|
|
257
|
+
)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def lgpl2_1
|
|
261
|
+
License.new(
|
|
262
|
+
short_name: 'LGPL2_1',
|
|
263
|
+
spdx_id: 'LGPL-2.1-only',
|
|
264
|
+
pretty_name: 'GNU Lesser General Public License version 2.1',
|
|
265
|
+
other_names: [
|
|
266
|
+
'LGPL 2.1',
|
|
267
|
+
'LGPL v2.1',
|
|
268
|
+
'GNU Lesser General Public License 2.1'
|
|
269
|
+
],
|
|
270
|
+
url: 'https://www.gnu.org/licenses/lgpl-2.1.txt'
|
|
271
|
+
)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def mit
|
|
275
|
+
url_regexp = %r{MIT Licen[sc]e.*http://(?:www\.)?opensource\.org/licenses/mit-license}
|
|
276
|
+
header_regexp = /The MIT Licen[sc]e/
|
|
277
|
+
one_liner_regexp = /is released under the MIT licen[sc]e/
|
|
278
|
+
|
|
279
|
+
matcher = AnyMatcher.new(
|
|
280
|
+
Matcher.from_template(Template.named('MIT')),
|
|
281
|
+
Matcher.from_regex(url_regexp),
|
|
282
|
+
HeaderMatcher.new(Matcher.from_regex(header_regexp)),
|
|
283
|
+
Matcher.from_regex(one_liner_regexp)
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
License.new(
|
|
287
|
+
short_name: 'MIT',
|
|
288
|
+
spdx_id: 'MIT',
|
|
289
|
+
other_names: ['Expat', 'MIT license', 'MIT License (MIT)'],
|
|
290
|
+
url: 'http://opensource.org/licenses/mit-license',
|
|
291
|
+
matcher: matcher
|
|
292
|
+
)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def mpl1_1
|
|
296
|
+
header_regexp = /Mozilla Public Licen[sc]e.*Version 1\.1/im
|
|
297
|
+
|
|
298
|
+
header_regexp_matcher = Matcher.from_regex(header_regexp)
|
|
299
|
+
mpl1_1_tmpl = Template.named('MPL1_1')
|
|
300
|
+
|
|
301
|
+
matcher = AnyMatcher.new(
|
|
302
|
+
HeaderMatcher.new(header_regexp_matcher, 2),
|
|
303
|
+
Matcher.from_template(mpl1_1_tmpl)
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
License.new(
|
|
307
|
+
short_name: 'MPL1_1',
|
|
308
|
+
spdx_id: 'MPL-1.1',
|
|
309
|
+
pretty_name: 'Mozilla Public License 1.1',
|
|
310
|
+
other_names: [
|
|
311
|
+
'MPL-1.1',
|
|
312
|
+
'Mozilla 1.1',
|
|
313
|
+
'Mozilla Public License, Version 1.1',
|
|
314
|
+
'Mozilla Public License version 1.1'
|
|
315
|
+
],
|
|
316
|
+
url: 'https://www.mozilla.org/media/MPL/1.1/index.0c5913925d40.txt',
|
|
317
|
+
matcher: matcher
|
|
318
|
+
)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def mpl2
|
|
322
|
+
header_regexp = /Mozilla Public Licen[sc]e.*version 2\.0/
|
|
323
|
+
|
|
324
|
+
matcher = AnyMatcher.new(
|
|
325
|
+
Matcher.from_template(Template.named('MPL2')),
|
|
326
|
+
HeaderMatcher.new(Matcher.from_regex(header_regexp))
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
License.new(
|
|
330
|
+
short_name: 'MPL2',
|
|
331
|
+
spdx_id: 'MPL-2.0',
|
|
332
|
+
pretty_name: 'Mozilla Public License 2.0',
|
|
333
|
+
other_names: [
|
|
334
|
+
'MPL-2.0',
|
|
335
|
+
'Mozilla 2.0',
|
|
336
|
+
'Mozilla Public License, Version 2.0',
|
|
337
|
+
'Mozilla Public License version 2.0'
|
|
338
|
+
],
|
|
339
|
+
url: 'https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt',
|
|
340
|
+
matcher: matcher
|
|
341
|
+
)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def newbsd
|
|
345
|
+
template = Template.named('NewBSD')
|
|
346
|
+
alternate_content = template.content.gsub(
|
|
347
|
+
'Neither the name of <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.',
|
|
348
|
+
'The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.'
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
matcher = AnyMatcher.new(
|
|
352
|
+
Matcher.from_template(template),
|
|
353
|
+
Matcher.from_text(alternate_content)
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
License.new(
|
|
357
|
+
short_name: 'NewBSD',
|
|
358
|
+
spdx_id: 'BSD-3-Clause',
|
|
359
|
+
pretty_name: 'New BSD',
|
|
360
|
+
other_names: [
|
|
361
|
+
'Modified BSD',
|
|
362
|
+
'BSD3',
|
|
363
|
+
'BSD 3',
|
|
364
|
+
'BSD-3',
|
|
365
|
+
'3-clause BSD',
|
|
366
|
+
'3-Clause BSD License',
|
|
367
|
+
'BSD 3-Clause',
|
|
368
|
+
'BSD 3-Clause License',
|
|
369
|
+
'BSD 3-clause New License',
|
|
370
|
+
'New BSD License',
|
|
371
|
+
'BSD New license',
|
|
372
|
+
'BSD License 3',
|
|
373
|
+
'BSD Licence 3'
|
|
374
|
+
],
|
|
375
|
+
url: 'http://opensource.org/licenses/BSD-3-Clause',
|
|
376
|
+
matcher: matcher
|
|
377
|
+
)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def ofl
|
|
381
|
+
License.new(
|
|
382
|
+
short_name: 'OFL',
|
|
383
|
+
spdx_id: 'OFL-1.1',
|
|
384
|
+
pretty_name: 'SIL OPEN FONT LICENSE Version 1.1',
|
|
385
|
+
other_names: [
|
|
386
|
+
'OPEN FONT LICENSE Version 1.1'
|
|
387
|
+
],
|
|
388
|
+
url: 'https://opensource.org/licenses/OFL-1.1'
|
|
389
|
+
)
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def python
|
|
393
|
+
License.new(
|
|
394
|
+
short_name: 'Python',
|
|
395
|
+
spdx_id: 'PSF-2.0',
|
|
396
|
+
pretty_name: 'Python Software Foundation License',
|
|
397
|
+
other_names: [
|
|
398
|
+
'PSF',
|
|
399
|
+
'PSF 2.0',
|
|
400
|
+
'PSFL',
|
|
401
|
+
'Python 2.0',
|
|
402
|
+
'PSF License',
|
|
403
|
+
'PSF License 2.0'
|
|
404
|
+
],
|
|
405
|
+
url: 'http://hg.python.org/cpython/raw-file/89ce323357db/LICENSE'
|
|
406
|
+
)
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
def ruby
|
|
410
|
+
url = 'http://www.ruby-lang.org/en/LICENSE.txt'
|
|
411
|
+
|
|
412
|
+
matcher = AnyMatcher.new(
|
|
413
|
+
Matcher.from_template(Template.named('Ruby')),
|
|
414
|
+
Matcher.from_text(url)
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
License.new(
|
|
418
|
+
short_name: 'Ruby',
|
|
419
|
+
spdx_id: 'Ruby',
|
|
420
|
+
pretty_name: 'ruby',
|
|
421
|
+
url: url,
|
|
422
|
+
matcher: matcher
|
|
423
|
+
)
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
def simplifiedbsd
|
|
427
|
+
License.new(
|
|
428
|
+
short_name: 'SimplifiedBSD',
|
|
429
|
+
spdx_id: 'BSD-2-Clause',
|
|
430
|
+
pretty_name: 'Simplified BSD',
|
|
431
|
+
other_names: [
|
|
432
|
+
'FreeBSD',
|
|
433
|
+
'2-clause BSD',
|
|
434
|
+
'BSD 2-Clause',
|
|
435
|
+
'BSD 2-Clause License'
|
|
436
|
+
],
|
|
437
|
+
url: 'http://opensource.org/licenses/bsd-license'
|
|
438
|
+
)
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
def unlicense
|
|
442
|
+
License.new(
|
|
443
|
+
short_name: 'Unlicense',
|
|
444
|
+
spdx_id: 'Unlicense',
|
|
445
|
+
pretty_name: 'The Unlicense',
|
|
446
|
+
url: 'https://unlicense.org/'
|
|
447
|
+
)
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
def wtfpl
|
|
451
|
+
License.new(
|
|
452
|
+
short_name: 'WTFPL',
|
|
453
|
+
spdx_id: 'WTFPL',
|
|
454
|
+
pretty_name: 'WTFPL',
|
|
455
|
+
other_names: [
|
|
456
|
+
'WTFPL V2',
|
|
457
|
+
'Do What The Fuck You Want To Public License'
|
|
458
|
+
],
|
|
459
|
+
url: 'http://www.wtfpl.net/'
|
|
460
|
+
)
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
def zerobsd
|
|
464
|
+
matcher = AnyMatcher.new(
|
|
465
|
+
Matcher.from_template(Template.named('0BSD'))
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
License.new(
|
|
469
|
+
short_name: '0BSD',
|
|
470
|
+
spdx_id: '0BSD',
|
|
471
|
+
pretty_name: 'BSD Zero Clause License',
|
|
472
|
+
other_names: [
|
|
473
|
+
'0-Clause BSD',
|
|
474
|
+
'Zero-Clause BSD',
|
|
475
|
+
'BSD-0-Clause',
|
|
476
|
+
'BSD-Zero-Clause',
|
|
477
|
+
'BSD 0-Clause',
|
|
478
|
+
'BSD Zero-Clause'
|
|
479
|
+
],
|
|
480
|
+
url: 'https://opensource.org/licenses/0BSD',
|
|
481
|
+
matcher: matcher
|
|
482
|
+
)
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
def zlib
|
|
486
|
+
License.new(
|
|
487
|
+
short_name: 'Zlib',
|
|
488
|
+
spdx_id: 'Zlib',
|
|
489
|
+
pretty_name: 'zlib/libpng license',
|
|
490
|
+
other_names: [
|
|
491
|
+
'zlib License'
|
|
492
|
+
],
|
|
493
|
+
url: 'https://opensource.org/licenses/Zlib'
|
|
494
|
+
)
|
|
495
|
+
end
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LicenseFinder
|
|
4
|
+
class License
|
|
5
|
+
HeaderMatcher = Struct.new(:base_matcher, :first_n_lines) do
|
|
6
|
+
def matches_text?(text)
|
|
7
|
+
n = if first_n_lines.nil?
|
|
8
|
+
1
|
|
9
|
+
else
|
|
10
|
+
first_n_lines
|
|
11
|
+
end
|
|
12
|
+
header = text.lines.first(n).join || ''
|
|
13
|
+
base_matcher.matches_text?(header)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LicenseFinder
|
|
4
|
+
class License
|
|
5
|
+
Matcher = Struct.new(:regexp) do
|
|
6
|
+
def self.from_template(template)
|
|
7
|
+
from_text(template.content)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.from_text(text)
|
|
11
|
+
from_regex(Text.compile_to_regex(text))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# an alias for Matcher.new, for uniformity of constructors
|
|
15
|
+
def self.from_regex(regexp)
|
|
16
|
+
new(regexp)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def matches_text?(text)
|
|
20
|
+
!!(Text.normalize_punctuation(text) =~ regexp)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LicenseFinder
|
|
4
|
+
class License
|
|
5
|
+
class Template
|
|
6
|
+
TEMPLATE_PATH = ROOT_PATH.join('license', 'templates')
|
|
7
|
+
|
|
8
|
+
def self.named(name)
|
|
9
|
+
new TEMPLATE_PATH.join("#{name}.txt").read
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :content
|
|
13
|
+
|
|
14
|
+
def initialize(raw_content)
|
|
15
|
+
@content = Text.normalize_punctuation(raw_content)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2
|
+
purpose with or without fee is hereby granted.
|
|
3
|
+
|
|
4
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
5
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
7
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
8
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
10
|
+
PERFORMANCE OF THIS SOFTWARE.
|