license_finder 5.9.2 → 5.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Dockerfile +1 -1
- data/VERSION +1 -1
- data/ci/pipelines/pull-request.yml.erb +1 -1
- data/ci/pipelines/release.yml.erb +1 -1
- data/ci/tasks/rubocop.yml +1 -1
- data/ci/tasks/update-changelog.yml +1 -1
- data/lib/license_finder/cli/base.rb +1 -0
- data/lib/license_finder/cli/main.rb +1 -0
- data/lib/license_finder/configuration.rb +4 -0
- data/lib/license_finder/core.rb +2 -1
- data/lib/license_finder/package_manager.rb +1 -1
- data/lib/license_finder/package_managers/bundler.rb +8 -3
- data/lib/license_finder/package_managers/dotnet.rb +1 -1
- data/lib/license_finder/package_managers/mix.rb +36 -10
- data/lib/license_finder/package_managers/yarn.rb +1 -1
- data/license_finder.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f523ba2c6fa31d014881ee139ea643859d311aa86c5e1c478a42c37534d08da
|
4
|
+
data.tar.gz: 04264f68a64b7260576135ee6069aeb0c36d5220e0bde8744a398901083fb4ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95faa766907dc8c749770916ddd7daa5d59560de2abdf23ed6203ca363a62a7a4563f345e28abb4ef04ad8de311356f076a987220c48a2f300a439eabe5b531
|
7
|
+
data.tar.gz: f9a05a6f98983222ecfed1c916a1084f8c6f4a6645a81d2725a8c98c6b1c805d9f422e137a1d3b39145666058da9f23568dfebee7a74467e1c249925380530ed
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# [5.10.0] / 2019-08-26
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
* Dotnet projects only detected if csproj is at root level - [b9f810d](https://github.com/pivotal/LicenseFinder/commit/b9f810d96f92f458fcfe4855307fdddfb7f1082b)
|
5
|
+
* sha for composer-setup.php - [64b782a](https://github.com/pivotal/LicenseFinder/commit/64b782a137a287980a317fcb48f595b6e93f85d0) - Debbie Chen
|
6
|
+
|
1
7
|
# [5.9.2] / 2019-07-02
|
2
8
|
|
3
9
|
### Changed
|
@@ -733,3 +739,4 @@ Bugfixes:
|
|
733
739
|
[5.9.0]: https://github.com/pivotal/LicenseFinder/compare/v5.8.0...v5.9.0
|
734
740
|
[5.9.1]: https://github.com/pivotal/LicenseFinder/compare/v5.9.0...v5.9.1
|
735
741
|
[5.9.2]: https://github.com/pivotal/LicenseFinder/compare/v5.9.1...v5.9.2
|
742
|
+
[5.10.0]: https://github.com/pivotal/LicenseFinder/compare/v5.9.2...v5.10.0
|
data/Dockerfile
CHANGED
@@ -150,7 +150,7 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5
|
|
150
150
|
apt-get update &&\
|
151
151
|
apt-get install -y php7.1-cli &&\
|
152
152
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&\
|
153
|
-
php -r "if (hash_file('sha384', 'composer-setup.php') === '
|
153
|
+
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
|
154
154
|
php composer-setup.php &&\
|
155
155
|
php -r "unlink('composer-setup.php');" &&\
|
156
156
|
mv composer.phar /usr/bin/composer
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.10.0
|
data/ci/tasks/rubocop.yml
CHANGED
@@ -32,6 +32,7 @@ module LicenseFinder
|
|
32
32
|
class_option :pip_requirements_path, desc: 'Path to python requirements file. Defaults to requirements.txt.'
|
33
33
|
class_option :rebar_command, desc: "Command to use when fetching rebar packages. Only meaningful if used with a Erlang/rebar project. Defaults to 'rebar'."
|
34
34
|
class_option :rebar_deps_dir, desc: "Path to rebar dependencies directory. Only meaningful if used with a Erlang/rebar project. Defaults to 'deps'."
|
35
|
+
class_option :elixir_command, desc: "Command to use when parsing package metadata for Mix. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'elixir'."
|
35
36
|
class_option :mix_command, desc: "Command to use when fetching packages through Mix. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'mix'."
|
36
37
|
class_option :mix_deps_dir, desc: "Path to Mix dependencies directory. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'deps'."
|
37
38
|
class_option :sbt_include_groups, desc: 'Whether dependency name should include group id. Only meaningful if used with a Scala/sbt project. Defaults to false.'
|
data/lib/license_finder/core.rb
CHANGED
@@ -87,7 +87,7 @@ module LicenseFinder
|
|
87
87
|
FileUtils.rmtree config.log_directory, secure: true if File.directory? config.log_directory
|
88
88
|
end
|
89
89
|
|
90
|
-
def options
|
90
|
+
def options # rubocop:disable Metrics/AbcSize
|
91
91
|
{
|
92
92
|
logger: logger,
|
93
93
|
project_path: config.project_path,
|
@@ -101,6 +101,7 @@ module LicenseFinder
|
|
101
101
|
pip_requirements_path: config.pip_requirements_path,
|
102
102
|
rebar_command: config.rebar_command,
|
103
103
|
rebar_deps_dir: config.rebar_deps_dir,
|
104
|
+
elixir_command: config.elixir_command,
|
104
105
|
mix_command: config.mix_command,
|
105
106
|
mix_deps_dir: config.mix_deps_dir,
|
106
107
|
prepare: config.prepare,
|
@@ -60,7 +60,7 @@ module LicenseFinder
|
|
60
60
|
|
61
61
|
def initialize(options = {})
|
62
62
|
@prepare_no_fail = options[:prepare_no_fail]
|
63
|
-
@logger
|
63
|
+
@logger = options[:logger] || Core.default_logger
|
64
64
|
@project_path = options[:project_path]
|
65
65
|
@log_directory = options[:log_directory]
|
66
66
|
@ignored_groups = options[:ignored_groups]
|
@@ -55,7 +55,7 @@ module LicenseFinder
|
|
55
55
|
|
56
56
|
# clear gem paths before running specs_for
|
57
57
|
Gem.clear_paths
|
58
|
-
if
|
58
|
+
if bundler_config_path_found
|
59
59
|
::Bundler.reset!
|
60
60
|
::Bundler.configure
|
61
61
|
end
|
@@ -74,8 +74,13 @@ module LicenseFinder
|
|
74
74
|
project_path.join(lockfile)
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
78
|
-
project_path.join('.bundle')
|
77
|
+
def bundler_config_path_found
|
78
|
+
config_file = project_path.join('.bundle/config')
|
79
|
+
|
80
|
+
return false unless File.exist?(config_file)
|
81
|
+
|
82
|
+
content = File.readlines(config_file)
|
83
|
+
content.grep(/BUNDLE_PATH/).count.positive?
|
79
84
|
end
|
80
85
|
|
81
86
|
def log_package_dependencies(package)
|
@@ -5,7 +5,9 @@ module LicenseFinder
|
|
5
5
|
def initialize(options = {})
|
6
6
|
super
|
7
7
|
@command = options[:mix_command] || Mix.package_management_command
|
8
|
+
@elixir_command = options[:elixir_command] || 'elixir'
|
8
9
|
@deps_path = Pathname(options[:mix_deps_dir] || 'deps')
|
10
|
+
@licenses_by_package = load_all_licenses
|
9
11
|
end
|
10
12
|
|
11
13
|
def current_packages
|
@@ -20,23 +22,18 @@ module LicenseFinder
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
# Adapted from licenser: https://github.com/unnawut/licensir/blob/71f96f8734adc73c0651050bd9f0e20ff52c61a8/lib/licensir/scanner.ex#L61
|
24
25
|
def licenses(name)
|
25
|
-
|
26
|
-
# rubocop:disable Metrics/LineLength
|
27
|
-
args = "\\\"#{config_path}\\\" |> :file.consult() |> case do {:ok, metadata} -> metadata; {:error, _} -> [] end |> List.keyfind(\\\"licenses\\\", 0) |> case do {_, licenses} -> licenses; _ -> [] end |> Enum.join(\\\"\\t\\\") |> IO.puts()"
|
28
|
-
# rubocop:enable Metrics/LineLength
|
29
|
-
command = "#{@command} run --no-start --no-compile -e \"#{args}\""
|
30
|
-
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
|
31
|
-
raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
|
32
|
-
|
33
|
-
stdout.strip.split("\t")
|
26
|
+
@licenses_by_package.fetch(name, ['license is not in deps'])
|
34
27
|
end
|
35
28
|
|
36
29
|
def self.package_management_command
|
37
30
|
'mix'
|
38
31
|
end
|
39
32
|
|
33
|
+
def self.package_lock_file
|
34
|
+
'mix.lock'
|
35
|
+
end
|
36
|
+
|
40
37
|
def self.prepare_command
|
41
38
|
'mix deps.get'
|
42
39
|
end
|
@@ -47,6 +44,35 @@ module LicenseFinder
|
|
47
44
|
|
48
45
|
private
|
49
46
|
|
47
|
+
def load_all_licenses
|
48
|
+
elixir_code = <<-ELIXIR
|
49
|
+
deps_path = "#{@deps_path}"
|
50
|
+
|
51
|
+
case File.ls(deps_path) do
|
52
|
+
{:ok, dirs} ->
|
53
|
+
Enum.reduce(dirs, [], fn name, acc ->
|
54
|
+
with hexmetadata_file <- Path.join([deps_path, name, "hex_metadata.config"]),
|
55
|
+
{:ok, metadata} <- :file.consult(hexmetadata_file),
|
56
|
+
{"licenses", licenses} <- List.keyfind(metadata, "licenses", 0) do
|
57
|
+
[[name, licenses] | acc]
|
58
|
+
else
|
59
|
+
_ -> acc
|
60
|
+
end
|
61
|
+
end)
|
62
|
+
{:error, _} ->
|
63
|
+
[]
|
64
|
+
end
|
65
|
+
|> IO.inspect(limit: :infinity)
|
66
|
+
ELIXIR
|
67
|
+
command = "#{@elixir_command} -e '#{elixir_code}'"
|
68
|
+
return {} unless File.directory?(project_path)
|
69
|
+
|
70
|
+
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
|
71
|
+
raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
|
72
|
+
|
73
|
+
Hash[JSON.parse(stdout)]
|
74
|
+
end
|
75
|
+
|
50
76
|
def end_of_package_lines?(line)
|
51
77
|
line == 'ok'
|
52
78
|
end
|
data/license_finder.gemspec
CHANGED
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
s.add_development_dependency 'rake'
|
60
60
|
s.add_development_dependency 'rspec', '~> 3'
|
61
61
|
s.add_development_dependency 'rspec-its'
|
62
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
62
|
+
s.add_development_dependency 'rubocop', '~> 0.74.0'
|
63
63
|
s.add_development_dependency 'rubocop-performance', '~> 1.4.0'
|
64
64
|
s.add_development_dependency 'webmock', '~> 3.5'
|
65
65
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Collins
|
@@ -27,7 +27,7 @@ authors:
|
|
27
27
|
autorequire:
|
28
28
|
bindir: bin
|
29
29
|
cert_chain: []
|
30
|
-
date: 2019-
|
30
|
+
date: 2019-08-26 00:00:00.000000000 Z
|
31
31
|
dependencies:
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: bundler
|
@@ -231,14 +231,14 @@ dependencies:
|
|
231
231
|
requirements:
|
232
232
|
- - "~>"
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
version: 0.
|
234
|
+
version: 0.74.0
|
235
235
|
type: :development
|
236
236
|
prerelease: false
|
237
237
|
version_requirements: !ruby/object:Gem::Requirement
|
238
238
|
requirements:
|
239
239
|
- - "~>"
|
240
240
|
- !ruby/object:Gem::Version
|
241
|
-
version: 0.
|
241
|
+
version: 0.74.0
|
242
242
|
- !ruby/object:Gem::Dependency
|
243
243
|
name: rubocop-performance
|
244
244
|
requirement: !ruby/object:Gem::Requirement
|
@@ -483,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
483
483
|
- !ruby/object:Gem::Version
|
484
484
|
version: '0'
|
485
485
|
requirements: []
|
486
|
-
rubygems_version: 3.0.
|
486
|
+
rubygems_version: 3.0.6
|
487
487
|
signing_key:
|
488
488
|
specification_version: 4
|
489
489
|
summary: Audit the OSS licenses of your application's dependencies.
|