licensee 9.15.1 → 9.15.2
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 +4 -4
- data/lib/licensee/commands/detect.rb +1 -1
- data/lib/licensee/commands/diff.rb +2 -4
- data/lib/licensee/content_helper.rb +3 -3
- data/lib/licensee/license.rb +3 -4
- data/lib/licensee/matchers/copyright.rb +1 -1
- data/lib/licensee/matchers/dice.rb +5 -7
- data/lib/licensee/project_files/license_file.rb +5 -7
- data/lib/licensee/projects/git_project.rb +5 -7
- data/lib/licensee/projects/project.rb +13 -19
- data/lib/licensee/version.rb +1 -1
- data/lib/licensee.rb +6 -3
- data/licensee.gemspec +1 -0
- data/spec/fixtures/detect.json +1 -1
- data/spec/fixtures/license-hashes.json +3 -2
- data/spec/licensee/content_helper_spec.rb +1 -1
- data/spec/licensee/license_spec.rb +3 -3
- data/spec/licensee/matchers/dice_matcher_spec.rb +1 -1
- data/spec/licensee/project_files/license_file_spec.rb +1 -1
- data/spec/licensee/project_files/package_info_spec.rb +2 -2
- data/spec/licensee/project_spec.rb +3 -2
- data/spec/licensee_spec.rb +8 -2
- data/spec/vendored_license_spec.rb +0 -2
- data/vendor/choosealicense.com/_licenses/0bsd.txt +4 -2
- data/vendor/choosealicense.com/_licenses/afl-3.0.txt +12 -12
- data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +2 -2
- data/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/isc.txt +8 -8
- data/vendor/choosealicense.com/_licenses/mulanpsl-2.0.txt +226 -0
- data/vendor/choosealicense.com/_licenses/odbl-1.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/osl-3.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/upl-1.0.txt +1 -1
- data/vendor/license-list-XML/src/0BSD.xml +5 -1
- data/vendor/license-list-XML/src/AGPL-3.0.xml +4 -4
- data/vendor/license-list-XML/src/Apache-2.0.xml +1 -1
- data/vendor/license-list-XML/src/BSD-2-Clause.xml +1 -1
- data/vendor/license-list-XML/src/BSD-3-Clause.xml +1 -1
- data/vendor/license-list-XML/src/CC-BY-4.0.xml +13 -11
- data/vendor/license-list-XML/src/CC-BY-SA-4.0.xml +13 -11
- data/vendor/license-list-XML/src/GPL-3.0.xml +5 -5
- data/vendor/license-list-XML/src/ISC.xml +7 -5
- data/vendor/license-list-XML/src/LGPL-3.0.xml +1 -1
- data/vendor/license-list-XML/src/MPL-2.0.xml +1 -1
- data/vendor/license-list-XML/src/MulanPSL-2.0.xml +167 -0
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 334874469d14f16839113e4311ba232c18a8bc8d0ee0c618034ec30e16497f47
|
|
4
|
+
data.tar.gz: aaca8fc841545017ee7dc58e02a8ce41845d3253a281153b599f187218c6fc6a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cd4ba6ef792da1ca97536e14b78d92c2fddf01dd14405fb859ad74db0f30018af62ea67af39a754f4a568f83f14a932d501772d83f1b5d19d22833fd8937e20
|
|
7
|
+
data.tar.gz: 9fa7c61dde8ce35d2003c1119206047c3a35179e17484d0d5528e145f99bab29882c3da004a22214c777f758ade7607289a0d73a696135cc3a9c49467ed24238
|
|
@@ -95,7 +95,7 @@ class LicenseeCLI < Thor
|
|
|
95
95
|
def licenses_by_similarity(matched_file)
|
|
96
96
|
matcher = Licensee::Matchers::Dice.new(matched_file)
|
|
97
97
|
potential_licenses = Licensee.licenses(hidden: true).select(&:wordset)
|
|
98
|
-
matcher.instance_variable_set(
|
|
98
|
+
matcher.instance_variable_set(:@potential_licenses, potential_licenses)
|
|
99
99
|
matcher.licenses_by_similarity
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -41,11 +41,9 @@ class LicenseeCLI < Thor
|
|
|
41
41
|
|
|
42
42
|
def license_to_diff
|
|
43
43
|
return options[:license_to_diff] if options[:license_to_diff]
|
|
44
|
-
return project.license_file if remote? || $stdin.tty? && project.license_file
|
|
44
|
+
return project.license_file if remote? || ($stdin.tty? && project.license_file)
|
|
45
45
|
|
|
46
|
-
@license_to_diff ||=
|
|
47
|
-
Licensee::ProjectFiles::LicenseFile.new($stdin.read, 'LICENSE')
|
|
48
|
-
end
|
|
46
|
+
@license_to_diff ||= Licensee::ProjectFiles::LicenseFile.new($stdin.read, 'LICENSE')
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
def expected_license
|
|
@@ -7,7 +7,7 @@ module Licensee
|
|
|
7
7
|
module ContentHelper
|
|
8
8
|
DIGEST = Digest::SHA1
|
|
9
9
|
START_REGEX = /\A\s*/.freeze
|
|
10
|
-
END_OF_TERMS_REGEX = /^[\s#*_]*end of terms and conditions[\s#*_]*$/i.freeze
|
|
10
|
+
END_OF_TERMS_REGEX = /^[\s#*_]*end of (the )?terms and conditions[\s#*_]*$/i.freeze
|
|
11
11
|
REGEXES = {
|
|
12
12
|
bom: /#{START_REGEX}\xEF\xBB\xBF/,
|
|
13
13
|
hrs: /^\s*[=\-*]{3,}\s*$/,
|
|
@@ -128,7 +128,7 @@ module Licensee
|
|
|
128
128
|
overlap = (wordset_fieldless & other.wordset).size
|
|
129
129
|
total = wordset_fieldless.size + other.wordset.size -
|
|
130
130
|
fields_normalized_set.size
|
|
131
|
-
(overlap * 200.0) / (total + variation_adjusted_length_delta(other) / 4)
|
|
131
|
+
(overlap * 200.0) / (total + (variation_adjusted_length_delta(other) / 4))
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
# SHA1 of the normalized content
|
|
@@ -341,7 +341,7 @@ module Licensee
|
|
|
341
341
|
# Use that if it's present, otherwise, just return the simple delta.
|
|
342
342
|
return delta unless respond_to?(:spdx_alt_segments, true)
|
|
343
343
|
|
|
344
|
-
adjusted_delta = delta - [fields_normalized.size, spdx_alt_segments].max * 4
|
|
344
|
+
adjusted_delta = delta - ([fields_normalized.size, spdx_alt_segments].max * 4)
|
|
345
345
|
adjusted_delta.positive? ? adjusted_delta : 0
|
|
346
346
|
end
|
|
347
347
|
end
|
data/lib/licensee/license.rb
CHANGED
|
@@ -145,6 +145,7 @@ module Licensee
|
|
|
145
145
|
return @title_regex if defined? @title_regex
|
|
146
146
|
|
|
147
147
|
string = name.downcase.sub('*', 'u')
|
|
148
|
+
simple_title_regex = Regexp.new string, 'i'
|
|
148
149
|
string.sub!(/\Athe /i, '')
|
|
149
150
|
string.sub!(/,? version /, ' ')
|
|
150
151
|
string.sub!(/v(\d+\.\d+)/, '\1')
|
|
@@ -159,7 +160,7 @@ module Licensee
|
|
|
159
160
|
string << '(?:\ licen[sc]e)?'
|
|
160
161
|
key_regex = Regexp.new string, 'i'
|
|
161
162
|
|
|
162
|
-
parts = [title_regex, key_regex]
|
|
163
|
+
parts = [simple_title_regex, title_regex, key_regex]
|
|
163
164
|
parts.push Regexp.new meta.nickname.sub(/\bGNU /i, '(?:GNU )?') if meta.nickname
|
|
164
165
|
|
|
165
166
|
@title_regex = Regexp.union parts
|
|
@@ -238,9 +239,7 @@ module Licensee
|
|
|
238
239
|
# Returns a string with `[fields]` replaced by `{{{fields}}}`
|
|
239
240
|
# Does not mangle non-supported fields in the form of `[field]`
|
|
240
241
|
def content_for_mustache
|
|
241
|
-
@content_for_mustache ||=
|
|
242
|
-
content.gsub(LicenseField::FIELD_REGEX, '{{{\1}}}')
|
|
243
|
-
end
|
|
242
|
+
@content_for_mustache ||= content.gsub(LicenseField::FIELD_REGEX, '{{{\1}}}')
|
|
244
243
|
end
|
|
245
244
|
|
|
246
245
|
private
|
|
@@ -6,7 +6,7 @@ module Licensee
|
|
|
6
6
|
attr_reader :file
|
|
7
7
|
|
|
8
8
|
COPYRIGHT_SYMBOLS = Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
|
|
9
|
-
REGEX = /#{ContentHelper::START_REGEX}(
|
|
9
|
+
REGEX = /#{ContentHelper::START_REGEX}([_*\-\s]*#{COPYRIGHT_SYMBOLS}.*$)+$/i.freeze
|
|
10
10
|
def match
|
|
11
11
|
# NOTE: must use content, and not content_normalized here
|
|
12
12
|
Licensee::License.find('no-license') if /#{REGEX}+\z/io.match?(file.content.strip)
|
|
@@ -21,13 +21,11 @@ module Licensee
|
|
|
21
21
|
# 2. The percentage change in file length may not exceed the inverse
|
|
22
22
|
# of the confidence threshold
|
|
23
23
|
def potential_matches
|
|
24
|
-
@potential_matches ||=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
license.wordset
|
|
30
|
-
end
|
|
24
|
+
@potential_matches ||= super.select do |license|
|
|
25
|
+
if license.creative_commons? && file.potential_false_positive?
|
|
26
|
+
false
|
|
27
|
+
else
|
|
28
|
+
license.wordset
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
end
|
|
@@ -62,13 +62,11 @@ module Licensee
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def attribution
|
|
65
|
-
@attribution ||=
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
end
|
|
65
|
+
@attribution ||= if copyright? || license.content&.include?('[fullname]')
|
|
66
|
+
matches = Matchers::Copyright::REGEX
|
|
67
|
+
.match(content_without_title_and_version)
|
|
68
|
+
matches[0] if matches
|
|
69
|
+
end
|
|
72
70
|
end
|
|
73
71
|
|
|
74
72
|
# Is this file likely to result in a creative commons false positive?
|
|
@@ -27,13 +27,11 @@ module Licensee
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def repository
|
|
30
|
-
@repository ||=
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
end
|
|
30
|
+
@repository ||= if @raw_repo.is_a? Rugged::Repository
|
|
31
|
+
@raw_repo
|
|
32
|
+
else
|
|
33
|
+
Rugged::Repository.new(@raw_repo)
|
|
34
|
+
end
|
|
37
35
|
rescue Rugged::OSError, Rugged::RepositoryError
|
|
38
36
|
raise InvalidRepository
|
|
39
37
|
end
|
|
@@ -43,9 +43,7 @@ module Licensee
|
|
|
43
43
|
|
|
44
44
|
# Returns an array of matches LicenseFiles
|
|
45
45
|
def matched_files
|
|
46
|
-
@matched_files ||=
|
|
47
|
-
project_files.select(&:license)
|
|
48
|
-
end
|
|
46
|
+
@matched_files ||= project_files.select(&:license)
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
# Returns the LicenseFile used to determine the License
|
|
@@ -54,19 +52,17 @@ module Licensee
|
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
def license_files
|
|
57
|
-
@license_files ||=
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
end
|
|
55
|
+
@license_files ||= if files.empty? || files.nil?
|
|
56
|
+
[]
|
|
57
|
+
else
|
|
58
|
+
files = find_files do |n|
|
|
59
|
+
Licensee::ProjectFiles::LicenseFile.name_score(n)
|
|
60
|
+
end
|
|
61
|
+
files = files.map do |file|
|
|
62
|
+
Licensee::ProjectFiles::LicenseFile.new(load_file(file), file)
|
|
63
|
+
end
|
|
64
|
+
prioritize_lgpl(files)
|
|
65
|
+
end
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
def readme_file
|
|
@@ -155,9 +151,7 @@ module Licensee
|
|
|
155
151
|
# Returns an array of matches licenses, excluding the COPYRIGHT file
|
|
156
152
|
# which can often be ignored for purposes of determing dual licensing
|
|
157
153
|
def licenses_without_copyright
|
|
158
|
-
@licenses_without_copyright ||=
|
|
159
|
-
matched_files.reject(&:copyright?).map(&:license).uniq
|
|
160
|
-
end
|
|
154
|
+
@licenses_without_copyright ||= matched_files.reject(&:copyright?).map(&:license).uniq
|
|
161
155
|
end
|
|
162
156
|
|
|
163
157
|
def files
|
data/lib/licensee/version.rb
CHANGED
data/lib/licensee.rb
CHANGED
|
@@ -24,8 +24,6 @@ module Licensee
|
|
|
24
24
|
DOMAIN = 'http://choosealicense.com'
|
|
25
25
|
|
|
26
26
|
class << self
|
|
27
|
-
attr_writer :confidence_threshold
|
|
28
|
-
|
|
29
27
|
# Returns an array of Licensee::License instances
|
|
30
28
|
def licenses(options = {})
|
|
31
29
|
Licensee::License.all(options)
|
|
@@ -50,11 +48,16 @@ module Licensee
|
|
|
50
48
|
@confidence_threshold ||= CONFIDENCE_THRESHOLD
|
|
51
49
|
end
|
|
52
50
|
|
|
51
|
+
def confidence_threshold=(value)
|
|
52
|
+
@confidence_threshold = value
|
|
53
|
+
@inverse_confidence_threshold = nil
|
|
54
|
+
end
|
|
55
|
+
|
|
53
56
|
# Inverse of the confidence threshold, represented as a float
|
|
54
57
|
# By default this will be 0.02
|
|
55
58
|
def inverse_confidence_threshold
|
|
56
59
|
@inverse_confidence_threshold ||=
|
|
57
|
-
(1 - Licensee.confidence_threshold / 100.0).round(2)
|
|
60
|
+
(1 - (Licensee.confidence_threshold / 100.0)).round(2)
|
|
58
61
|
end
|
|
59
62
|
end
|
|
60
63
|
end
|
data/licensee.gemspec
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\n gem.bindir = 'bin'\n gem.executables << 'licensee'\n\n gem.add_dependency('dotenv', '~> 2.0')\n gem.add_dependency('octokit', '~> 4.20')\n gem.add_dependency('reverse_markdown', '~> 1.0')\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', '~> 2.0')\n gem.add_development_dependency('simplecov', '~> 0.16')\n gem.add_development_dependency('webmock', '~> 3.1')\n\n gem.required_ruby_version = '>= 2.5'\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",
|
|
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.0')\n gem.add_dependency('octokit', '~> 4.20')\n gem.add_dependency('reverse_markdown', '~> 1.0')\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', '~> 2.0')\n gem.add_development_dependency('simplecov', '~> 0.16')\n gem.add_development_dependency('webmock', '~> 3.1')\n\n gem.required_ruby_version = '>= 2.5'\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": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"bsd-4-clause": "3b2917580b2b6f13efaaea37546b8b7a53716a30",
|
|
11
11
|
"bsl-1.0": "27e28f20b57048cf04be07e1532b6fb501a0753b",
|
|
12
12
|
"cc-by-4.0": "b2089be110aca4cf4a562a88f0ecfd082ce32167",
|
|
13
|
-
"cc-by-sa-4.0": "
|
|
13
|
+
"cc-by-sa-4.0": "0684e2df6671166351097b387abc0d1170d26f2f",
|
|
14
14
|
"cc0-1.0": "94c8187ec82b2b4a69fb990f80833fbe6e3c95e7",
|
|
15
15
|
"cecill-2.1": "edb804827a40bcdcf3e82b6bab3bd1f5b923ac74",
|
|
16
16
|
"ecl-2.0": "296976ce9e84ba380866e4519b68a779c2059b3a",
|
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
"mpl-2.0": "820048a1dbef5dfac65547bd9eb935beb76b2257",
|
|
30
30
|
"ms-pl": "1a7eb02101924998c296c8ede182005d2f77ae4a",
|
|
31
31
|
"ms-rl": "9f0c4c8be853cf1836a619cd0abaf0e0235d76ad",
|
|
32
|
+
"mulanpsl-2.0": "c9b54da98007cb8baa0a658b34dbe3a55a80baa8",
|
|
32
33
|
"ncsa": "0d481a7ff9345e19cfdd9b7fea46caea1ebd08ee",
|
|
33
|
-
"odbl-1.0": "
|
|
34
|
+
"odbl-1.0": "e3bb38ce8a932d226829dcb6fd2143e5977d13e7",
|
|
34
35
|
"ofl-1.1": "f92ca13e3976f94f20b49a007f7592631b4f8e96",
|
|
35
36
|
"osl-3.0": "bdde11f936b834bd06451d1ad8aad790d4a7c72c",
|
|
36
37
|
"postgresql": "6bddd8a2425baa88ee240b1c54b532d6208028bd",
|
|
@@ -67,7 +67,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
|
67
67
|
|
|
68
68
|
it 'knows the similarity' do
|
|
69
69
|
expect(mit.similarity(subject)).to be_within(1).of(4)
|
|
70
|
-
expect(mit.similarity(mit)).to
|
|
70
|
+
expect(mit.similarity(mit)).to eq(100.0)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
it 'calculates simple delta for similarity' do
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
RSpec.describe Licensee::License do
|
|
4
|
-
let(:license_count) {
|
|
5
|
-
let(:hidden_license_count) {
|
|
4
|
+
let(:license_count) { 43 }
|
|
5
|
+
let(:hidden_license_count) { 30 }
|
|
6
6
|
let(:featured_license_count) { 3 }
|
|
7
7
|
let(:pseudo_license_count) { 2 }
|
|
8
8
|
let(:non_featured_license_count) do
|
|
@@ -300,7 +300,7 @@ RSpec.describe Licensee::License do
|
|
|
300
300
|
end
|
|
301
301
|
|
|
302
302
|
it 'knows equality' do
|
|
303
|
-
expect(mit).to eql(mit)
|
|
303
|
+
expect(described_class.find('mit')).to eql(mit)
|
|
304
304
|
expect(gpl).not_to eql(mit)
|
|
305
305
|
end
|
|
306
306
|
|
|
@@ -24,7 +24,7 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
|
|
|
24
24
|
context 'with an non-UTF-8-encoded license' do
|
|
25
25
|
let(:content) { "\x91License\x93".dup.force_encoding('windows-1251') }
|
|
26
26
|
|
|
27
|
-
it "doesn't blow up
|
|
27
|
+
it "doesn't blow up" do
|
|
28
28
|
expect(subject.attribution).to be_nil
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -31,7 +31,7 @@ RSpec.describe Licensee::ProjectFiles::PackageManagerFile do
|
|
|
31
31
|
context 'matchers' do
|
|
32
32
|
let(:possible_matchers) { subject.possible_matchers }
|
|
33
33
|
|
|
34
|
-
context 'with a gemspec
|
|
34
|
+
context 'with a gemspec' do
|
|
35
35
|
let(:filename) { 'project.gemspec' }
|
|
36
36
|
|
|
37
37
|
it 'returns the gemspec matcher' do
|
|
@@ -39,7 +39,7 @@ RSpec.describe Licensee::ProjectFiles::PackageManagerFile do
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
context 'with cabal file
|
|
42
|
+
context 'with cabal file' do
|
|
43
43
|
let(:filename) { 'test.cabal' }
|
|
44
44
|
|
|
45
45
|
it 'returns the cabal matcher' do
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
let(:revision) { subject.repository.last_commit.oid }
|
|
67
67
|
|
|
68
68
|
before do
|
|
69
|
-
subject.instance_variable_set(
|
|
69
|
+
subject.instance_variable_set(:@revision, revision)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it 'returns the commit' do
|
|
@@ -116,11 +116,12 @@
|
|
|
116
116
|
|
|
117
117
|
if described_class == Licensee::Projects::FSProject
|
|
118
118
|
context 'with search root argument' do
|
|
119
|
+
subject { described_class.new(path, search_root: search_root) }
|
|
120
|
+
|
|
119
121
|
let(:fixture) { 'license-in-parent-folder/license-folder/package' }
|
|
120
122
|
let(:path) { fixture_path(fixture) }
|
|
121
123
|
let(:license_folder) { 'license-in-parent-folder/license-folder' }
|
|
122
124
|
let(:search_root) { fixture_path(license_folder) }
|
|
123
|
-
let(:subject) { described_class.new(path, search_root: search_root) }
|
|
124
125
|
let(:files) { subject.send(:files) }
|
|
125
126
|
|
|
126
127
|
it 'looks for licenses in parent directories up to the search root' do
|
data/spec/licensee_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ RSpec.describe Licensee do
|
|
|
4
4
|
let(:project_path) { fixture_path('mit') }
|
|
5
5
|
let(:license_path) { fixture_path('mit/LICENSE.txt') }
|
|
6
6
|
let(:mit_license) { Licensee::License.find('mit') }
|
|
7
|
-
let(:hidden_license_count) {
|
|
7
|
+
let(:hidden_license_count) { 43 }
|
|
8
8
|
|
|
9
9
|
it 'exposes licenses' do
|
|
10
10
|
expect(described_class.licenses).to be_an(Array)
|
|
@@ -43,7 +43,7 @@ RSpec.describe Licensee do
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'exposes the inverse of the confidence threshold' do
|
|
46
|
-
expect(described_class.inverse_confidence_threshold).to
|
|
46
|
+
expect(described_class.inverse_confidence_threshold).to eq(0.02)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
context 'user overridden' do
|
|
@@ -54,6 +54,12 @@ RSpec.describe Licensee do
|
|
|
54
54
|
it 'lets the user override the confidence threshold' do
|
|
55
55
|
expect(described_class.confidence_threshold).to be(50)
|
|
56
56
|
end
|
|
57
|
+
|
|
58
|
+
it 'resets inverse confidence threshold when confidence threshold changes' do
|
|
59
|
+
expect(described_class.inverse_confidence_threshold).to be(0.5)
|
|
60
|
+
described_class.confidence_threshold = Licensee::CONFIDENCE_THRESHOLD
|
|
61
|
+
expect(described_class.inverse_confidence_threshold).to be(0.02)
|
|
62
|
+
end
|
|
57
63
|
end
|
|
58
64
|
end
|
|
59
65
|
end
|
|
@@ -5,8 +5,6 @@ RSpec.describe 'vendored licenses' do
|
|
|
5
5
|
let(:license_file) do
|
|
6
6
|
Licensee::ProjectFiles::LicenseFile.new(content, filename)
|
|
7
7
|
end
|
|
8
|
-
let(:detected_license) { license_file&.license }
|
|
9
|
-
let(:wtfpl) { Licensee::License.find('wtfpl') }
|
|
10
8
|
|
|
11
9
|
Licensee.licenses(hidden: true).each do |license|
|
|
12
10
|
next if license.pseudo_license?
|
|
@@ -7,9 +7,9 @@ description: The BSD Zero Clause license goes further than the BSD 2-Clause lice
|
|
|
7
7
|
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders. You may take the additional step of removing the copyright notice.
|
|
8
8
|
|
|
9
9
|
using:
|
|
10
|
-
|
|
11
|
-
smoltcp: https://github.com/m-labs/smoltcp/blob/master/LICENSE-0BSD.txt
|
|
10
|
+
gatsby-starter-default: https://github.com/gatsbyjs/gatsby-starter-default/blob/master/LICENSE
|
|
12
11
|
Toybox: https://github.com/landley/toybox/blob/master/LICENSE
|
|
12
|
+
PickMeUp: https://github.com/nazar-pc/PickMeUp/blob/master/copying.md
|
|
13
13
|
|
|
14
14
|
permissions:
|
|
15
15
|
- commercial-use
|
|
@@ -25,6 +25,8 @@ limitations:
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
+
BSD Zero Clause License
|
|
29
|
+
|
|
28
30
|
Copyright (c) [year] [fullname]
|
|
29
31
|
|
|
30
32
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -33,27 +33,27 @@ authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
|
|
33
33
|
following licensing notice adjacent to the copyright notice for the Original
|
|
34
34
|
Work:
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Licensed under the Academic Free License version 3.0
|
|
37
37
|
|
|
38
38
|
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free,
|
|
39
39
|
non-exclusive, sublicensable license, for the duration of the copyright, to do
|
|
40
40
|
the following:
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
a) to reproduce the Original Work in copies, either alone or as part of a
|
|
43
|
+
collective work;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
b) to translate, adapt, alter, transform, modify, or arrange the Original
|
|
46
|
+
Work, thereby creating derivative works ("Derivative Works") based upon the
|
|
47
|
+
Original Work;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
c) to distribute or communicate copies of the Original Work and Derivative
|
|
50
|
+
Works to the public, under any license of your choice that does not
|
|
51
|
+
contradict the terms and conditions, including Licensor's reserved rights
|
|
52
|
+
and remedies, in this Academic Free License;
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
d) to perform the Original Work publicly; and
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
e) to display the Original Work publicly.
|
|
57
57
|
|
|
58
58
|
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free,
|
|
59
59
|
non-exclusive, sublicensable license, under patent claims owned or controlled
|
|
@@ -3,12 +3,12 @@ title: BSD 3-Clause "New" or "Revised" License
|
|
|
3
3
|
spdx-id: BSD-3-Clause
|
|
4
4
|
hidden: false
|
|
5
5
|
|
|
6
|
-
description: A permissive license similar to the <a href="/licenses/bsd-2-clause/">BSD 2-Clause License</a>, but with a 3rd clause that prohibits others from using the name of the
|
|
6
|
+
description: A permissive license similar to the <a href="/licenses/bsd-2-clause/">BSD 2-Clause License</a>, but with a 3rd clause that prohibits others from using the name of the copyright holder or its contributors to promote derived products without written consent.
|
|
7
7
|
|
|
8
8
|
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.
|
|
9
9
|
|
|
10
10
|
using:
|
|
11
|
-
|
|
11
|
+
Flutter: https://github.com/flutter/flutter/blob/master/LICENSE
|
|
12
12
|
LevelDB: https://github.com/google/leveldb/blob/master/LICENSE
|
|
13
13
|
Quill: https://github.com/quilljs/quill/blob/develop/LICENSE
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of
|
|
|
8
8
|
|
|
9
9
|
using:
|
|
10
10
|
caniuse: https://github.com/Fyrd/caniuse/blob/master/LICENSE
|
|
11
|
-
|
|
11
|
+
FiveThirtyEight data: https://github.com/fivethirtyeight/data/blob/master/LICENSE
|
|
12
12
|
Kubernetes documentation: https://github.com/kubernetes/website/blob/master/LICENSE
|
|
13
13
|
|
|
14
14
|
permissions:
|
|
@@ -335,8 +335,8 @@ apply to Your use of the Licensed Material:
|
|
|
335
335
|
contents in a database in which You have Sui Generis Database
|
|
336
336
|
Rights, then the database in which You have Sui Generis Database
|
|
337
337
|
Rights (but not its individual contents) is Adapted Material,
|
|
338
|
-
|
|
339
338
|
including for purposes of Section 3(b); and
|
|
339
|
+
|
|
340
340
|
c. You must comply with the conditions in Section 3(a) if You Share
|
|
341
341
|
all or a substantial portion of the contents of the database.
|
|
342
342
|
|
|
@@ -28,16 +28,16 @@ limitations:
|
|
|
28
28
|
|
|
29
29
|
ISC License
|
|
30
30
|
|
|
31
|
-
Copyright (c) [year]
|
|
31
|
+
Copyright (c) [year] [fullname]
|
|
32
32
|
|
|
33
33
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
34
|
purpose with or without fee is hereby granted, provided that the above
|
|
35
35
|
copyright notice and this permission notice appear in all copies.
|
|
36
36
|
|
|
37
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|