license_scout 0.1.3 → 1.0.0
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 +5 -5
- data/README.md +13 -5
- data/bin/license_scout +39 -1
- data/bin/rebar_lock_json +0 -0
- data/erl_src/rebar_lock_json/README.md +17 -0
- data/erl_src/rebar_lock_json/rebar.config +19 -0
- data/erl_src/rebar_lock_json/rebar.lock +36 -0
- data/erl_src/rebar_lock_json/src/rebar_lock_json.app.src +17 -0
- data/erl_src/rebar_lock_json/src/rebar_lock_json.erl +20 -0
- data/lib/license_scout/canonical_licenses/BSD-2-Clause.txt +19 -0
- data/lib/license_scout/canonical_licenses/BSD-3-Clause.txt +27 -0
- data/lib/license_scout/canonical_licenses/Chef-MLSA.txt +5 -0
- data/lib/license_scout/collector.rb +1 -1
- data/lib/license_scout/dependency_manager/base.rb +8 -1
- data/lib/license_scout/dependency_manager/berkshelf.rb +1 -1
- data/lib/license_scout/dependency_manager/bundler.rb +1 -1
- data/lib/license_scout/dependency_manager/cpanm.rb +160 -0
- data/lib/license_scout/dependency_manager/dep.rb +87 -0
- data/lib/license_scout/dependency_manager/glide.rb +79 -0
- data/lib/license_scout/dependency_manager/godep.rb +71 -0
- data/lib/license_scout/dependency_manager/rebar.rb +6 -35
- data/lib/license_scout/dependency_manager.rb +5 -2
- data/lib/license_scout/license_file_analyzer/definitions.rb +8 -1
- data/lib/license_scout/license_file_analyzer/templates/Apache2.txt +0 -2
- data/lib/license_scout/license_file_analyzer/templates/Chef-MLSA.txt +5 -0
- data/lib/license_scout/net_fetcher.rb +1 -0
- data/lib/license_scout/options.rb +1 -1
- data/lib/license_scout/overrides.rb +553 -19
- data/lib/license_scout/version.rb +1 -1
- metadata +45 -13
- data/.gitignore +0 -9
- data/.rspec +0 -3
- data/.rubocop.yml +0 -4
- data/.travis.yml +0 -11
- data/Gemfile +0 -24
- data/Rakefile +0 -39
- data/appveyor.yml +0 -19
- data/bin/config_to_json +0 -0
- data/lib/license_scout/dependency_manager/cpan.rb +0 -322
- data/license_scout.gemspec +0 -54
@@ -0,0 +1,71 @@
|
|
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 "ffi_yajl"
|
19
|
+
require "license_scout/dependency_manager/base"
|
20
|
+
|
21
|
+
module LicenseScout
|
22
|
+
module DependencyManager
|
23
|
+
class Godep < Base
|
24
|
+
|
25
|
+
def name
|
26
|
+
"go_godep"
|
27
|
+
end
|
28
|
+
|
29
|
+
def detected?
|
30
|
+
File.exist?(root_godeps_file)
|
31
|
+
end
|
32
|
+
|
33
|
+
def dependencies
|
34
|
+
godeps = File.open(root_godeps_file) do |f|
|
35
|
+
FFI_Yajl::Parser.parse(f)
|
36
|
+
end
|
37
|
+
|
38
|
+
godeps["Deps"].map do |pkg_info|
|
39
|
+
pkg_import_name = pkg_info["ImportPath"]
|
40
|
+
pkg_file_name = pkg_import_name.tr("/", "_")
|
41
|
+
pkg_version = pkg_info["Comment"] || pkg_info["Rev"]
|
42
|
+
license = options.overrides.license_for("go", pkg_import_name, pkg_version)
|
43
|
+
|
44
|
+
override_license_files = options.overrides.license_files_for("go", pkg_import_name, pkg_version)
|
45
|
+
if override_license_files.empty?
|
46
|
+
license_files = find_license_files_for_package_in_gopath(pkg_import_name)
|
47
|
+
else
|
48
|
+
license_files = override_license_files.resolve_locations(gopath(pkg_import_name))
|
49
|
+
end
|
50
|
+
|
51
|
+
create_dependency(pkg_file_name, pkg_version, license, license_files)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def root_godeps_file
|
58
|
+
File.join(project_dir, "Godeps/Godeps.json")
|
59
|
+
end
|
60
|
+
|
61
|
+
def gopath(pkg)
|
62
|
+
"#{ENV['GOPATH']}/src/#{pkg}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def find_license_files_for_package_in_gopath(pkg)
|
66
|
+
root_files = Dir["#{gopath(pkg)}/*"]
|
67
|
+
root_files.select { |f| POSSIBLE_LICENSE_FILES.include?(File.basename(f)) }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -103,46 +103,17 @@ module LicenseScout
|
|
103
103
|
|
104
104
|
return unless File.exist?(rebar_lock_path)
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
# escript to be on the path so we use the environment provided to
|
109
|
-
# license_scout if available.
|
110
|
-
|
111
|
-
config_to_json_path = File.expand_path("../../../bin/config_to_json", File.dirname(__FILE__))
|
112
|
-
s = Mixlib::ShellOut.new("#{config_to_json_path} #{rebar_lock_path}", environment: options.environment)
|
106
|
+
rebar_lock_to_json_path = File.expand_path("../../../bin/rebar_lock_json", File.dirname(__FILE__))
|
107
|
+
s = Mixlib::ShellOut.new("#{rebar_lock_to_json_path} #{rebar_lock_path}", environment: options.environment)
|
113
108
|
s.run_command
|
114
109
|
s.error!
|
115
110
|
|
116
|
-
# Parsed rebar.lock will contain "type" information for each field
|
117
|
-
# prepended into the output array. What we get from it looks like this:
|
118
|
-
# [["__tuple",
|
119
|
-
# "__binary_edown",
|
120
|
-
# ["__tuple",
|
121
|
-
# "git",
|
122
|
-
# "__string_git://github.com/seth/edown.git",
|
123
|
-
# ["__tuple", "ref", "__string_30a9f7867d615af45783235faa52742d11a9348e"]],
|
124
|
-
# 1],
|
125
|
-
# ["__tuple",
|
126
|
-
# "__binary_mochiweb",
|
127
|
-
# ["__tuple", "pkg", "__binary_mochiweb", "__binary_2.12.2"],
|
128
|
-
# 2],
|
129
|
-
# ...
|
130
|
-
#
|
131
111
|
rebar_lock_content = FFI_Yajl::Parser.parse(s.stdout)
|
132
112
|
|
133
|
-
rebar_lock_content.each do |
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
# erlang_template_helper gem since it is not released to rubygems.
|
138
|
-
|
139
|
-
next if !element.is_a?(Array) || element.length < 3
|
140
|
-
source_info = element[2]
|
141
|
-
|
142
|
-
next if !source_info.is_a?(Array) || source_info.length < 4
|
143
|
-
if source_info[1] == "pkg"
|
144
|
-
source_name = source_info[2].gsub("__binary_", "").gsub("__string_", "")
|
145
|
-
source_version = source_info[3].gsub("__binary_", "").gsub("__string_", "")
|
113
|
+
rebar_lock_content.each do |name, source_info|
|
114
|
+
if source_info["type"] == "pkg"
|
115
|
+
source_name = source_info["pkg_name"]
|
116
|
+
source_version = source_info["pkg_version"]
|
146
117
|
|
147
118
|
packaged_dependencies[source_name] = source_version
|
148
119
|
end
|
@@ -17,7 +17,10 @@
|
|
17
17
|
|
18
18
|
require "license_scout/dependency_manager/bundler"
|
19
19
|
require "license_scout/dependency_manager/rebar"
|
20
|
-
require "license_scout/dependency_manager/
|
20
|
+
require "license_scout/dependency_manager/cpanm"
|
21
|
+
require "license_scout/dependency_manager/godep"
|
22
|
+
require "license_scout/dependency_manager/dep"
|
23
|
+
require "license_scout/dependency_manager/glide"
|
21
24
|
require "license_scout/dependency_manager/berkshelf"
|
22
25
|
require "license_scout/dependency_manager/npm"
|
23
26
|
require "license_scout/dependency_manager/manual"
|
@@ -25,7 +28,7 @@ require "license_scout/dependency_manager/manual"
|
|
25
28
|
module LicenseScout
|
26
29
|
module DependencyManager
|
27
30
|
def self.implementations
|
28
|
-
[Bundler, Rebar,
|
31
|
+
[Bundler, Rebar, Cpanm, Berkshelf, NPM, Godep, Dep, Glide, Manual]
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -64,6 +64,7 @@ module LicenseScout
|
|
64
64
|
ruby,
|
65
65
|
bsd_2_clause,
|
66
66
|
erlang_public,
|
67
|
+
chef_mlsa,
|
67
68
|
]
|
68
69
|
end
|
69
70
|
|
@@ -107,7 +108,7 @@ module LicenseScout
|
|
107
108
|
|
108
109
|
def lgpl
|
109
110
|
License.new(
|
110
|
-
short_name:
|
111
|
+
short_name: "LGPL-3.0"
|
111
112
|
)
|
112
113
|
end
|
113
114
|
|
@@ -207,6 +208,12 @@ module LicenseScout
|
|
207
208
|
)
|
208
209
|
end
|
209
210
|
|
211
|
+
def chef_mlsa
|
212
|
+
License.new(
|
213
|
+
short_name: "Chef-MLSA"
|
214
|
+
)
|
215
|
+
end
|
216
|
+
|
210
217
|
end
|
211
218
|
end
|
212
219
|
end
|