license_scout 1.3.17 → 2.0.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/README.md +195 -0
- data/bin/license_scout +3 -59
- data/bin/mix_lock_json +0 -0
- data/bin/rebar_lock_json +0 -0
- data/lib/license_scout/cli.rb +99 -0
- data/lib/license_scout/collector.rb +25 -77
- data/lib/license_scout/config.rb +94 -0
- data/lib/license_scout/data/dependeny_manifest_v2_schema.json +62 -0
- data/lib/license_scout/data/exceptions.json +306 -0
- data/lib/license_scout/data/licenses.json +4653 -0
- data/lib/license_scout/dependency.rb +79 -7
- data/lib/license_scout/dependency_manager/base.rb +74 -42
- data/lib/license_scout/dependency_manager/berkshelf.rb +25 -50
- data/lib/license_scout/dependency_manager/bundler/_bundler_script.rb +1 -1
- data/lib/license_scout/dependency_manager/bundler.rb +47 -69
- data/lib/license_scout/dependency_manager/cpanm.rb +62 -112
- data/lib/license_scout/dependency_manager/dep.rb +29 -36
- data/lib/license_scout/dependency_manager/glide.rb +25 -36
- data/lib/license_scout/dependency_manager/godep.rb +27 -26
- data/lib/license_scout/dependency_manager/habitat.rb +126 -0
- data/lib/license_scout/dependency_manager/mix.rb +105 -0
- data/lib/license_scout/dependency_manager/npm.rb +30 -86
- data/lib/license_scout/dependency_manager/rebar.rb +26 -45
- data/lib/license_scout/dependency_manager.rb +19 -5
- data/lib/license_scout/exceptions.rb +2 -43
- data/lib/license_scout/license.rb +126 -0
- data/lib/license_scout/{license_file_analyzer.rb → log.rb} +4 -6
- data/lib/license_scout/reporter.rb +149 -55
- data/lib/license_scout/spdx.rb +123 -0
- data/lib/license_scout/version.rb +1 -1
- data/lib/license_scout.rb +2 -0
- data/native_parsers/mix_lock_json/README.md +21 -0
- data/native_parsers/mix_lock_json/lib/mix_lock_json.ex +20 -0
- data/native_parsers/mix_lock_json/mix.exs +31 -0
- data/native_parsers/mix_lock_json/mix.lock +3 -0
- data/{erl_src → native_parsers}/rebar_lock_json/rebar.lock +2 -2
- metadata +144 -67
- data/lib/license_scout/canonical_licenses/BSD-2-Clause.txt +0 -19
- data/lib/license_scout/canonical_licenses/BSD-3-Clause.txt +0 -27
- data/lib/license_scout/canonical_licenses/BSD-4-Clause.txt +0 -31
- data/lib/license_scout/canonical_licenses/Chef-MLSA.txt +0 -5
- data/lib/license_scout/canonical_licenses/ISC.txt +0 -14
- data/lib/license_scout/canonical_licenses/MIT.txt +0 -20
- data/lib/license_scout/dependency_manager/bundler/LICENSE.md +0 -23
- data/lib/license_scout/dependency_manager/json/README.md +0 -392
- data/lib/license_scout/dependency_manager/manual.rb +0 -67
- data/lib/license_scout/license_file_analyzer/any_matcher.rb +0 -37
- data/lib/license_scout/license_file_analyzer/definitions.rb +0 -219
- data/lib/license_scout/license_file_analyzer/header_matcher.rb +0 -34
- data/lib/license_scout/license_file_analyzer/matcher.rb +0 -46
- data/lib/license_scout/license_file_analyzer/template.rb +0 -45
- data/lib/license_scout/license_file_analyzer/templates/Apache2-short.txt +0 -11
- data/lib/license_scout/license_file_analyzer/templates/Apache2.txt +0 -170
- data/lib/license_scout/license_file_analyzer/templates/BSD-2-Clause-bullets.txt +0 -18
- data/lib/license_scout/license_file_analyzer/templates/BSD-2-Clause.txt +0 -19
- data/lib/license_scout/license_file_analyzer/templates/BSD-3-Clause-alt-format.txt +0 -24
- data/lib/license_scout/license_file_analyzer/templates/BSD-3-Clause.txt +0 -21
- data/lib/license_scout/license_file_analyzer/templates/BSD.txt +0 -24
- data/lib/license_scout/license_file_analyzer/templates/Chef-MLSA.txt +0 -5
- data/lib/license_scout/license_file_analyzer/templates/EPLICENSE.txt +0 -286
- data/lib/license_scout/license_file_analyzer/templates/GPL-2.0.txt +0 -339
- data/lib/license_scout/license_file_analyzer/templates/GPL-3.0.txt +0 -674
- data/lib/license_scout/license_file_analyzer/templates/ISC.txt +0 -2
- data/lib/license_scout/license_file_analyzer/templates/LGPL-3.0.txt +0 -165
- data/lib/license_scout/license_file_analyzer/templates/MIT.txt +0 -9
- data/lib/license_scout/license_file_analyzer/templates/MPL2.txt +0 -373
- data/lib/license_scout/license_file_analyzer/templates/Python-2.0.txt +0 -47
- data/lib/license_scout/license_file_analyzer/templates/Ruby.txt +0 -52
- data/lib/license_scout/license_file_analyzer/text.rb +0 -46
- data/lib/license_scout/net_fetcher.rb +0 -106
- data/lib/license_scout/options.rb +0 -47
- data/lib/license_scout/overrides.rb +0 -1125
- /data/{erl_src → native_parsers}/rebar_lock_json/README.md +0 -0
- /data/{erl_src → native_parsers}/rebar_lock_json/rebar.config +0 -0
- /data/{erl_src → native_parsers}/rebar_lock_json/src/rebar_lock_json.app.src +0 -0
- /data/{erl_src → native_parsers}/rebar_lock_json/src/rebar_lock_json.erl +0 -0
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copied from https://github.com/pivotal/LicenseFinder
|
2
|
-
#
|
3
|
-
# The MIT License
|
4
|
-
#
|
5
|
-
# Copyright (c) 2012 Pivotal Labs
|
6
|
-
#
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
# of this software and associated documentation files (the "Software"), to deal
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
12
|
-
# furnished to do so, subject to the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be included in
|
15
|
-
# all copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
# THE SOFTWARE.
|
24
|
-
|
25
|
-
module LicenseScout
|
26
|
-
module LicenseFileAnalyzer
|
27
|
-
module Text
|
28
|
-
SPACES = /[[:space:]]+/.freeze
|
29
|
-
QUOTES = /['`"]{1,2}/.freeze
|
30
|
-
PLACEHOLDERS = /<[^<>]+>/.freeze
|
31
|
-
|
32
|
-
def self.normalize_punctuation(text)
|
33
|
-
text.gsub(SPACES, " ")
|
34
|
-
.gsub(QUOTES, '"')
|
35
|
-
.strip
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.compile_to_regex(text)
|
39
|
-
text = normalize_punctuation(text)
|
40
|
-
regex_source = Regexp.escape(text)
|
41
|
-
regex_source = regex_source.gsub(PLACEHOLDERS, "(.*)")
|
42
|
-
Regexp.new(regex_source, Regexp::IGNORECASE)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright 2016, Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require "open-uri" unless defined?(OpenURI)
|
19
|
-
require "tmpdir" unless defined?(Dir.mktmpdir)
|
20
|
-
require "digest" unless defined?(Digest)
|
21
|
-
require "socket" unless defined?(Socket) # Defines `SocketError`
|
22
|
-
require "timeout" unless defined?(Timeout)
|
23
|
-
|
24
|
-
require "license_scout/exceptions"
|
25
|
-
|
26
|
-
module LicenseScout
|
27
|
-
class NetFetcher
|
28
|
-
|
29
|
-
def self.remote?(uri_or_path)
|
30
|
-
!URI(uri_or_path).scheme.nil?
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.cache(uri)
|
34
|
-
fetcher = new(uri)
|
35
|
-
fetcher.fetch!
|
36
|
-
fetcher.cache_path
|
37
|
-
end
|
38
|
-
|
39
|
-
attr_reader :from_url
|
40
|
-
|
41
|
-
def initialize(from_url)
|
42
|
-
@from_url = from_url
|
43
|
-
end
|
44
|
-
|
45
|
-
def fetch!
|
46
|
-
download_file! unless exists_in_cache?
|
47
|
-
end
|
48
|
-
|
49
|
-
def cache_dir
|
50
|
-
File.join(Dir.tmpdir, "license_scout_cache")
|
51
|
-
end
|
52
|
-
|
53
|
-
def cache_path
|
54
|
-
File.join(cache_dir, url_cache_key, File.basename(from_url))
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def exists_in_cache?
|
60
|
-
File.exist?(cache_path)
|
61
|
-
end
|
62
|
-
|
63
|
-
def url_cache_key
|
64
|
-
d = Digest::SHA256.new
|
65
|
-
d.update(from_url)
|
66
|
-
d.hexdigest
|
67
|
-
end
|
68
|
-
|
69
|
-
def save_to_cache(file)
|
70
|
-
cache_directory = File.dirname(cache_path)
|
71
|
-
FileUtils.mkdir_p(cache_directory) unless File.exist?(cache_directory)
|
72
|
-
|
73
|
-
File.open(cache_path, "w+") do |output_file|
|
74
|
-
output_file.print(file.read)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
# This method is highly inspired from:
|
79
|
-
# https://github.com/chef/omnibus/blob/master/lib/omnibus/download_helpers.rb
|
80
|
-
def download_file!
|
81
|
-
retries = 3
|
82
|
-
|
83
|
-
begin
|
84
|
-
options = {
|
85
|
-
read_timeout: 300,
|
86
|
-
}
|
87
|
-
|
88
|
-
URI.open(from_url, **options) do |f|
|
89
|
-
save_to_cache(f)
|
90
|
-
end
|
91
|
-
rescue SocketError,
|
92
|
-
Errno::ECONNREFUSED,
|
93
|
-
Errno::ECONNRESET,
|
94
|
-
Errno::ENETUNREACH,
|
95
|
-
Timeout::Error,
|
96
|
-
OpenURI::HTTPError => e
|
97
|
-
if retries != 0
|
98
|
-
retries -= 1
|
99
|
-
retry
|
100
|
-
else
|
101
|
-
raise Exceptions::NetworkError.new(from_url, e)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright 2016, Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require "license_scout/overrides"
|
19
|
-
|
20
|
-
module LicenseScout
|
21
|
-
class Options
|
22
|
-
SUPPORTED_OPTIONS = %i{overrides environment ruby_bin cpan_cache manual_licenses}.freeze
|
23
|
-
|
24
|
-
SUPPORTED_OPTIONS.each do |o|
|
25
|
-
send(:attr_reader, o)
|
26
|
-
end
|
27
|
-
|
28
|
-
def initialize(options = {})
|
29
|
-
SUPPORTED_OPTIONS.each do |o|
|
30
|
-
data = options[o] || defaults[o]
|
31
|
-
instance_variable_set("@#{o}".to_sym, data)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def defaults
|
38
|
-
{
|
39
|
-
overrides: Overrides.new,
|
40
|
-
environment: {},
|
41
|
-
ruby_bin: nil,
|
42
|
-
cpan_cache: Dir.tmpdir,
|
43
|
-
manual_licenses: nil,
|
44
|
-
}
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|