licensee 9.17.0 → 9.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/licensee/license_meta.rb +1 -1
- data/lib/licensee/project_files/license_file.rb +18 -11
- data/lib/licensee/version.rb +1 -1
- data/spec/fixtures/detect.json +1 -1
- data/spec/licensee/content_helper_spec.rb +1 -1
- data/spec/licensee/project_files/license_file_spec.rb +4 -12
- data/spec/spec_helper.rb +2 -2
- data/vendor/choosealicense.com/_licenses/mpl-2.0.txt +1 -1
- data/vendor/license-list-XML/src/Apache-2.0.xml +2 -0
- data/vendor/license-list-XML/src/BSD-3-Clause.xml +1 -1
- data/vendor/license-list-XML/src/LGPL-2.1.xml +3 -0
- data/vendor/license-list-XML/src/MPL-2.0.xml +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 224c5413c75e78cad466f9d41b8a18a8b0a7ddf348740521ed37dbea4e25e674
|
4
|
+
data.tar.gz: f73bde77074c0e4feff4190551effbaebd685abf539b944ed0509231090fe8be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75680afe6a50966f190c3748130cfb72b4b4d68a846aec482405e14756a9d1211754b1a94328e79f38619dc3ee3c1999490b9cab157fc7b76b8cc03661316a7b
|
7
|
+
data.tar.gz: 3622c24de4f843dd0f59f37a3db30c8a9e6feba68644f7dce4168adb7a304f97175a41595c70c789acdd4e2166bfa3eb6547b485ce7e0a476719457530652d54
|
@@ -9,21 +9,24 @@ module Licensee
|
|
9
9
|
PREFERRED_EXT = %w[md markdown txt html].freeze
|
10
10
|
PREFERRED_EXT_REGEX = /\.#{Regexp.union(PREFERRED_EXT)}\z/
|
11
11
|
|
12
|
-
# Regex to match any extension except .spdx or .header
|
13
|
-
LICENSE_EXT_REGEX = %r{\.(?!spdx|header)[^./]+\z}i
|
12
|
+
# Regex to match any extension and periods in version numbers except .spdx or .header
|
13
|
+
LICENSE_EXT_REGEX = %r{\.(?!spdx|header)([^./]|\.\d)+\z}i
|
14
14
|
|
15
|
-
# Regex to match any extension except a few unlikely as license
|
15
|
+
# Regex to match any extension and periods in version numbers except a few unlikely as license
|
16
16
|
# texts with complex filenames
|
17
|
-
OTHER_EXT_REGEX = %r{\.(?!xml|go|gemspec)[^./]+\z}i
|
17
|
+
OTHER_EXT_REGEX = %r{\.(?!xml|go|gemspec)([^./]|\.\d)+\z}i
|
18
18
|
|
19
|
-
# Regex to match any extension
|
20
|
-
ANY_EXT_REGEX = %r{\.[^./]+\z}i
|
19
|
+
# Regex to match any extension and periods in version numbers
|
20
|
+
ANY_EXT_REGEX = %r{\.([^./]|\.\d)+\z}i
|
21
21
|
|
22
22
|
# Regex to match, LICENSE, LICENCE, unlicense, etc.
|
23
23
|
LICENSE_REGEX = /(un)?licen[sc]e/i
|
24
24
|
|
25
|
-
# Regex to match COPYING
|
26
|
-
COPYING_REGEX = /
|
25
|
+
# Regex to match COPYING
|
26
|
+
COPYING_REGEX = /copying/i
|
27
|
+
|
28
|
+
# Regex to match COPYRIGHT
|
29
|
+
COPYRIGHT_REGEX = /copyright/i
|
27
30
|
|
28
31
|
# Regex to match OFL.
|
29
32
|
OFL_REGEX = /ofl/i
|
@@ -46,8 +49,12 @@ module Licensee
|
|
46
49
|
/\A#{OFL_REGEX}#{PREFERRED_EXT_REGEX}/ => 0.50, # OFL.md
|
47
50
|
/\A#{OFL_REGEX}#{OTHER_EXT_REGEX}/ => 0.45, # OFL.textile
|
48
51
|
/\A#{OFL_REGEX}\z/ => 0.40, # OFL
|
49
|
-
/\A#{
|
50
|
-
/\A#{
|
52
|
+
/\A#{COPYRIGHT_REGEX}\z/ => 0.35, # COPYRIGHT
|
53
|
+
/\A#{COPYRIGHT_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.30, # COPYRIGHT.txt
|
54
|
+
/\A#{COPYRIGHT_REGEX}#{OTHER_EXT_REGEX}\z/ => 0.25, # COPYRIGHT.textile
|
55
|
+
/\A#{COPYRIGHT_REGEX}[-_][^.]*#{OTHER_EXT_REGEX}?\z/ => 0.20, # COPYRIGHT-MIT
|
56
|
+
/\A#{PATENTS_REGEX}\z/ => 0.15, # PATENTS
|
57
|
+
/\A#{PATENTS_REGEX}#{OTHER_EXT_REGEX}\z/ => 0.10, # PATENTS.txt
|
51
58
|
// => 0.00 # Catch all
|
52
59
|
}.freeze
|
53
60
|
|
@@ -75,7 +82,7 @@ module Licensee
|
|
75
82
|
end
|
76
83
|
|
77
84
|
def lgpl?
|
78
|
-
LicenseFile.lesser_gpl_score(filename) == 1 && license
|
85
|
+
LicenseFile.lesser_gpl_score(filename) == 1 && license&.lgpl?
|
79
86
|
end
|
80
87
|
|
81
88
|
def gpl?
|
data/lib/licensee/version.rb
CHANGED
data/spec/fixtures/detect.json
CHANGED
@@ -93,7 +93,7 @@
|
|
93
93
|
},
|
94
94
|
{
|
95
95
|
"filename": "licensee.gemspec",
|
96
|
-
"content": "# frozen_string_literal: true\n\nrequire File.expand_path('lib/licensee/version', __dir__)\n\nGem::Specification.new do |gem|\n gem.name = 'licensee'\n gem.version = Licensee::VERSION\n\n gem.summary = 'A Ruby Gem to detect open source project licenses'\n gem.description = <<-DESC\n Licensee automates the process of reading LICENSE files and\n compares their contents to known licenses using a fancy maths.\n DESC\n\n gem.authors = ['Ben Balter']\n gem.email = 'ben.balter@github.com'\n gem.homepage = 'https://github.com/benbalter/licensee'\n gem.license = 'MIT'\n gem.metadata['rubygems_mfa_required'] = 'true'\n\n gem.bindir = 'bin'\n gem.executables << 'licensee'\n\n gem.add_dependency('dotenv', '>= 2', '< 4')\n gem.add_dependency('octokit', '>= 4.20', '<
|
96
|
+
"content": "# frozen_string_literal: true\n\nrequire File.expand_path('lib/licensee/version', __dir__)\n\nGem::Specification.new do |gem|\n gem.name = 'licensee'\n gem.version = Licensee::VERSION\n\n gem.summary = 'A Ruby Gem to detect open source project licenses'\n gem.description = <<-DESC\n Licensee automates the process of reading LICENSE files and\n compares their contents to known licenses using a fancy maths.\n DESC\n\n gem.authors = ['Ben Balter']\n gem.email = 'ben.balter@github.com'\n gem.homepage = 'https://github.com/benbalter/licensee'\n gem.license = 'MIT'\n gem.metadata['rubygems_mfa_required'] = 'true'\n\n gem.bindir = 'bin'\n gem.executables << 'licensee'\n\n gem.add_dependency('dotenv', '>= 2', '< 4')\n gem.add_dependency('octokit', '>= 4.20', '< 10.0')\n gem.add_dependency('reverse_markdown', '>= 1', '< 4')\n gem.add_dependency('rugged', '>= 0.24', '<2.0')\n gem.add_dependency('thor', '>= 0.19', '< 2.0')\n\n gem.add_development_dependency('gem-release', '~> 2.0')\n gem.add_development_dependency('mustache', '>= 0.9', '< 2.0')\n gem.add_development_dependency('pry', '~> 0.9')\n gem.add_development_dependency('rspec', '~> 3.5')\n gem.add_development_dependency('rubocop', '~> 1.0')\n gem.add_development_dependency('rubocop-performance', '~> 1.5')\n gem.add_development_dependency('rubocop-rspec', '~> 3.0')\n gem.add_development_dependency('simplecov', '~> 0.16')\n gem.add_development_dependency('webmock', '~> 3.1')\n\n gem.required_ruby_version = '>= 3.0'\n\n # ensure the gem is built out of versioned files\n gem.files = Dir[\n '{bin,lib,man,test,vendor,spec}/**/*',\n 'README*', 'LICENSE*'\n ] & `git ls-files -z`.split(\"\\0\")\nend\n",
|
97
97
|
"content_hash": null,
|
98
98
|
"content_normalized": null,
|
99
99
|
"matcher": {
|
@@ -261,7 +261,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
261
261
|
end
|
262
262
|
|
263
263
|
it 'normalizes http: to https:' do
|
264
|
-
license = Licensee::License.find('
|
264
|
+
license = Licensee::License.find('ofl-1.1')
|
265
265
|
expect(license.content).to include('http:')
|
266
266
|
expect(license.content_normalized).not_to include('http:')
|
267
267
|
end
|
@@ -65,18 +65,18 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
|
|
65
65
|
'LICENSE.md' => 0.95,
|
66
66
|
'license.txt' => 0.95,
|
67
67
|
'COPYING' => 0.90,
|
68
|
-
'copyRIGHT' => 0.
|
69
|
-
'COPYRIGHT.txt' => 0.
|
68
|
+
'copyRIGHT' => 0.35,
|
69
|
+
'COPYRIGHT.txt' => 0.30,
|
70
70
|
'copying.txt' => 0.85,
|
71
|
+
'LICENSE.MPL-2.0' => 0.80,
|
71
72
|
'LICENSE.php' => 0.80,
|
72
73
|
'LICENCE.docs' => 0.80,
|
73
74
|
'license.xml' => 0.80,
|
74
75
|
'copying.image' => 0.75,
|
75
|
-
'COPYRIGHT.go' => 0.75,
|
76
76
|
'LICENSE-MIT' => 0.70,
|
77
77
|
'LICENSE_1_0.txt' => 0.70,
|
78
78
|
'COPYING-GPL' => 0.65,
|
79
|
-
'COPYRIGHT-BSD' => 0.
|
79
|
+
'COPYRIGHT-BSD' => 0.20,
|
80
80
|
'MIT-LICENSE.txt' => 0.60,
|
81
81
|
'mit-license-foo.md' => 0.60,
|
82
82
|
'OFL.md' => 0.50,
|
@@ -151,14 +151,6 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
|
-
|
155
|
-
context 'copying regex' do
|
156
|
-
%w[COPYING copyright].each do |copying|
|
157
|
-
it "matches #{copying}" do
|
158
|
-
expect(described_class::COPYING_REGEX).to match(copying)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
154
|
end
|
163
155
|
|
164
156
|
context 'CC false positives' do
|
data/spec/spec_helper.rb
CHANGED
@@ -131,7 +131,7 @@ RSpec::Matchers.define :be_detected_as do |expected|
|
|
131
131
|
license_name = expected.meta['spdx-id'] || expected.key
|
132
132
|
similarity = expected.similarity(license_file)
|
133
133
|
content = @license_file.content
|
134
|
-
msg =
|
134
|
+
msg = "Expected '#{content}' to match the #{license_name} license"
|
135
135
|
msg << " (#{format_percent(similarity)} similarity"
|
136
136
|
msg << "using the #{license_file.matcher} matcher)"
|
137
137
|
end
|
@@ -141,7 +141,7 @@ RSpec::Matchers.define :be_detected_as do |expected|
|
|
141
141
|
license_name = expected.meta['spdx-id'] || expected.key
|
142
142
|
similarity = expected.similarity(license_file)
|
143
143
|
|
144
|
-
msg =
|
144
|
+
msg = "Expected the content to *not* match the #{license_name} license"
|
145
145
|
msg << " (#{format_percent(similarity)} similarity)"
|
146
146
|
end
|
147
147
|
|
@@ -393,7 +393,7 @@ Exhibit A - Source Code Form License Notice
|
|
393
393
|
|
394
394
|
This Source Code Form is subject to the terms of the Mozilla Public
|
395
395
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
396
|
-
file, You can obtain one at
|
396
|
+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
397
397
|
|
398
398
|
If it is not possible or desirable to put the notice in a particular
|
399
399
|
file, then You may include the notice in a location (such as a LICENSE
|
@@ -196,6 +196,8 @@
|
|
196
196
|
|
197
197
|
<optional>
|
198
198
|
<p>END OF TERMS AND CONDITIONS</p>
|
199
|
+
</optional>
|
200
|
+
<optional>
|
199
201
|
<p>APPENDIX: How to apply the Apache License to your work.</p>
|
200
202
|
<p>To apply the Apache License to your work, attach the following boilerplate notice, with the fields
|
201
203
|
enclosed by brackets "[]" replaced with your own identifying information. (Don't
|
@@ -28,7 +28,7 @@
|
|
28
28
|
</item>
|
29
29
|
<item>
|
30
30
|
<bullet>3.</bullet>
|
31
|
-
<alt match="(The\s+name\s+of.+may\s+not)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+their\s+contributors\s+may)|(\s*Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+its\s+authors\s+and\s+contributors\s+may)|(Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+(specific\s+)?contributors,?\s+may)|(Neither\s+the\s+name.+nor\s+the\s+names\s+of\s+contributors\s+may)|(The\s+names\s+of\s+its\s+contributors\s+may\s+not)|(The\s+names\s+of\s+any\s+contributors\s+may\s+not)|(The\s+names\s+of\s+the\s+contributors\s+may\s+not)|(None\s+of\s+the\s+names\s+of.+and\s+any\s+contributors\s+may)|(Neither\s+my\s+name.+nor\s+the\s+names\s+of\s+contributors\s+to\s+this\s+code\s+may)" name="organizationClause3">
|
31
|
+
<alt match="(The\s+name\s+of.+may\s+not)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+their\s+contributors\s+may)|(\s*Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+its\s+authors\s+and\s+contributors\s+may)|(Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+(specific\s+)?contributors,?\s+may)|(Neither\s+the\s+name.+nor\s+the\s+names\s+of\s+contributors\s+may)|(The\s+names\s+of\s+its\s+contributors\s+may\s+not)|(The\s+names\s+of\s+any\s+contributors\s+may\s+not)|(The\s+names\s+of\s+the\s+contributors\s+may\s+not)|(None\s+of\s+the\s+names\s+of.+and\s+any\s+contributors\s+may)|(Neither\s+my\s+name.+nor\s+the\s+names\s+of\s+contributors\s+to\s+this\s+code\s+may)|(Neither\s+name\s+of\s+copyright\s+holders\s+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)" name="organizationClause3">
|
32
32
|
Neither the name of the copyright holder nor the names of its contributors may</alt>
|
33
33
|
be used to endorse or promote products derived from this
|
34
34
|
<alt match="software|work" name="software">software</alt> without specific prior written permission.
|
@@ -166,6 +166,9 @@
|
|
166
166
|
The former contains code derived from the library, whereas
|
167
167
|
the latter must be combined with the library in order to run.
|
168
168
|
</p>
|
169
|
+
<p>
|
170
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
171
|
+
</p>
|
169
172
|
<p>
|
170
173
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
171
174
|
</p>
|
@@ -459,7 +459,7 @@
|
|
459
459
|
<optional><p>-------------------------------------------</p></optional>
|
460
460
|
<standardLicenseHeader>
|
461
461
|
<p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
|
462
|
-
was not distributed with this file, You can obtain one at
|
462
|
+
was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.</p>
|
463
463
|
</standardLicenseHeader>
|
464
464
|
<p>If it is not possible or desirable to put the notice in a particular file, then You may include the
|
465
465
|
notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: licensee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '4.20'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '10.0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '4.20'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '10.0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: reverse_markdown
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '1'
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '4'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '1'
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
72
|
+
version: '4'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rugged
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,14 +206,14 @@ dependencies:
|
|
206
206
|
requirements:
|
207
207
|
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: '
|
209
|
+
version: '3.0'
|
210
210
|
type: :development
|
211
211
|
prerelease: false
|
212
212
|
version_requirements: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - "~>"
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: '
|
216
|
+
version: '3.0'
|
217
217
|
- !ruby/object:Gem::Dependency
|
218
218
|
name: simplecov
|
219
219
|
requirement: !ruby/object:Gem::Requirement
|
@@ -519,7 +519,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
519
519
|
- !ruby/object:Gem::Version
|
520
520
|
version: '0'
|
521
521
|
requirements: []
|
522
|
-
rubygems_version: 3.
|
522
|
+
rubygems_version: 3.5.11
|
523
523
|
signing_key:
|
524
524
|
specification_version: 4
|
525
525
|
summary: A Ruby Gem to detect open source project licenses
|