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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aa62297dbdcb901e43f363712a622598ccafc440e3ed5bf56b977dfd988575e
4
- data.tar.gz: cdb7ac96c2760bd7332e3fddc2605efd0224fa4a60e23a0b437ee4779b3d8c08
3
+ metadata.gz: 7f523ba2c6fa31d014881ee139ea643859d311aa86c5e1c478a42c37534d08da
4
+ data.tar.gz: 04264f68a64b7260576135ee6069aeb0c36d5220e0bde8744a398901083fb4ef
5
5
  SHA512:
6
- metadata.gz: 53aae03975e9a80552a6bffb95d9a1238c7bd5ade88d2b8ef3e1af5b5208524ca2faa7282e369d677b388c18da55194010ecec89d9fae5f68bbcf4fb7eb265a7
7
- data.tar.gz: 6d34d2eb2fb02cc3997b8d68f8d9a5ada20ba55f84510d4477657d7b60c72a678d54a6e6ddec0c4ca5a696fe37edcc115795e350719c35ac02625bd722068f16
6
+ metadata.gz: b95faa766907dc8c749770916ddd7daa5d59560de2abdf23ed6203ca363a62a7a4563f345e28abb4ef04ad8de311356f076a987220c48a2f300a439eabe5b531
7
+ data.tar.gz: f9a05a6f98983222ecfed1c916a1084f8c6f4a6645a81d2725a8c98c6b1c805d9f422e137a1d3b39145666058da9f23568dfebee7a74467e1c249925380530ed
@@ -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') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
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.9.2
1
+ 5.10.0
@@ -9,7 +9,7 @@ resource_types:
9
9
 
10
10
  <% if setup_slack %>
11
11
  - name: slack-notification
12
- type: docker-image
12
+ type: registry-image
13
13
  source:
14
14
  repository: cfcommunity/slack-notification-resource
15
15
  tag: latest
@@ -4,7 +4,7 @@
4
4
  resource_types:
5
5
  <% if setup_slack %>
6
6
  - name: slack-notification
7
- type: docker-image
7
+ type: registry-image
8
8
  source:
9
9
  repository: cfcommunity/slack-notification-resource
10
10
  tag: latest
@@ -1,7 +1,7 @@
1
1
  platform: linux
2
2
 
3
3
  image_resource:
4
- type: docker-image
4
+ type: registry-image
5
5
  source:
6
6
  repository: ruby
7
7
  tag: 2.6.3
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  image_resource:
3
- type: docker-image
3
+ type: registry-image
4
4
  source:
5
5
  repository: brenix/alpine-bash-git-ssh
6
6
  tag: latest
@@ -40,6 +40,7 @@ module LicenseFinder
40
40
  :pip_requirements_path,
41
41
  :rebar_command,
42
42
  :rebar_deps_dir,
43
+ :elixir_command,
43
44
  :mix_command,
44
45
  :mix_deps_dir,
45
46
  :save,
@@ -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.'
@@ -22,6 +22,10 @@ module LicenseFinder
22
22
  true
23
23
  end
24
24
 
25
+ def elixir_command
26
+ get(:elixir_command) || 'elixir'
27
+ end
28
+
25
29
  def mix_command
26
30
  get(:mix_command) || 'mix'
27
31
  end
@@ -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 = options[:logger] || Core.default_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 File.exist?(bundler_config_path)
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 bundler_config_path
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)
@@ -53,7 +53,7 @@ module LicenseFinder
53
53
  end
54
54
 
55
55
  def possible_package_paths
56
- paths = Dir[project_path.join('**/*.csproj')]
56
+ paths = Dir[project_path.join('*.csproj')]
57
57
  paths.map { |p| Pathname(p) }
58
58
  end
59
59
 
@@ -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
- config_path = @deps_path.join(name).join('hex_metadata.config')
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
@@ -56,7 +56,7 @@ module LicenseFinder
56
56
  end
57
57
 
58
58
  def self.prepare_command
59
- 'yarn install'
59
+ 'yarn install --ignore-engines'
60
60
  end
61
61
 
62
62
  private
@@ -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.72.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.9.2
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-07-02 00:00:00.000000000 Z
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.72.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.72.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.4
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.