license_finder 6.8.2 → 6.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6280c04b3b05215777ec6e3db87cdff9766dfb6d53a699142710817c09b41335
4
- data.tar.gz: 3643643ad824644d608e4e6015a34c0de2892c217efe603d7fa66ec937bdeff9
3
+ metadata.gz: fc2352a955e259632d6033ca1ec13a03ef2d6925c0a0dde89f0bd4bbf125a333
4
+ data.tar.gz: 275ec53c07253065b18133ea74bfd4dc69f73cb1a6dff6ba6d08f4ee278111e8
5
5
  SHA512:
6
- metadata.gz: fc5928a7331d5012b13a87d0fb218fe8141c561e63ba8230e453a65bd206339d9cb593724e810ecd46f7dce231ab16d466df44a119bae1a4d64f00c0518dddaa
7
- data.tar.gz: 28fbde267804e39d141ad54cd71df26693b2857870be8a5d37a84a04202f25db6398e4e8f216f302e17ecf52daf5810f3db7682712c7a9a1249fb93544ff06a3
6
+ metadata.gz: 657b1f48fc7b0f592dbec7428610b8984c9be7f897b0eb2bd0379399d41286ea77b925298207633c48e388da2ffd46f99859fbd1e57d885b508ee434162316fd
7
+ data.tar.gz: 02e5b8f9fc1e70ddeb1bd87f55920d4c5537c82511cbbafb7ff96f622dee26f6e4dca3da7e9f03c321a44a1b0bdb6c2135638dd0ca3872169cebdc3731f7b4cc
@@ -1,3 +1,8 @@
1
+ # [6.9.0] / 2020-10-05
2
+
3
+ ### Changed
4
+ * to recognize permitted licenses with AND in the name [#173997648] - [eab14250](https://github.com/pivotal/LicenseFinder/commit/eab14250d188153f8c2b0b5c0191fec19bcddf55) - Raymond Lee
5
+
1
6
  # [6.8.2] / 2020-09-08
2
7
 
3
8
  # [6.8.1] / 2020-08-13
@@ -915,3 +920,4 @@ Bugfixes:
915
920
  [6.8.0]: https://github.com/pivotal/LicenseFinder/compare/v6.7.0...v6.8.0
916
921
  [6.8.1]: https://github.com/pivotal/LicenseFinder/compare/v6.8.0...v6.8.1
917
922
  [6.8.2]: https://github.com/pivotal/LicenseFinder/compare/v6.8.1...v6.8.2
923
+ [6.9.0]: https://github.com/pivotal/LicenseFinder/compare/v6.8.2...v6.9.0
data/Dockerfile CHANGED
@@ -159,7 +159,7 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5
159
159
  apt-get update &&\
160
160
  apt-get install -y php7.4-cli &&\
161
161
  php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&\
162
- php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
162
+ php -r "if (hash_file('sha384', 'composer-setup.php') === '795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
163
163
  php composer-setup.php &&\
164
164
  php -r "unlink('composer-setup.php');" &&\
165
165
  mv composer.phar /usr/bin/composer
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.8.2
1
+ 6.9.0
@@ -40,10 +40,15 @@ module LicenseFinder
40
40
  end
41
41
 
42
42
  def permitted?(lic)
43
- return lic.sub_licenses.any? { |sub_lic| @permitted.include?(sub_lic) } if lic.is_a?(OrLicense)
44
- return lic.sub_licenses.all? { |sub_lic| @permitted.include?(sub_lic) } if lic.is_a?(AndLicense)
45
-
46
- @permitted.include?(lic)
43
+ if @permitted.include?(lic)
44
+ true
45
+ elsif lic.is_a?(OrLicense)
46
+ lic.sub_licenses.any? { |sub_lic| @permitted.include?(sub_lic) }
47
+ elsif lic.is_a?(AndLicense)
48
+ lic.sub_licenses.all? { |sub_lic| @permitted.include?(sub_lic) }
49
+ else
50
+ false
51
+ end
47
52
  end
48
53
 
49
54
  def restricted?(lic)
@@ -19,10 +19,17 @@ module LicenseFinder
19
19
 
20
20
  def find_by_name(name)
21
21
  name ||= 'unknown'
22
- return OrLicense.new(name) if name.include?(OrLicense.operator)
23
- return AndLicense.new(name) if name.include?(AndLicense.operator)
24
-
25
- all.detect { |l| l.matches_name? l.stripped_name(name) } || Definitions.build_unrecognized(name)
22
+ license = all.detect { |l| l.matches_name? l.stripped_name(name) }
23
+
24
+ if license
25
+ license
26
+ elsif name.include?(OrLicense.operator)
27
+ OrLicense.new(name)
28
+ elsif name.include?(AndLicense.operator)
29
+ AndLicense.new(name)
30
+ else
31
+ Definitions.build_unrecognized(name)
32
+ end
26
33
  end
27
34
 
28
35
  def find_by_text(text)
@@ -123,8 +123,8 @@ module LicenseFinder
123
123
  end
124
124
 
125
125
  def log_errors_with_cmd(prep_cmd, stderr)
126
- logger.info prep_cmd, 'did not succeed.', color: :red
127
- logger.info prep_cmd, stderr, color: :red
126
+ logger.info(prep_cmd, 'did not succeed.', color: :red)
127
+ logger.info(prep_cmd, stderr, color: :red)
128
128
  log_to_file stderr
129
129
  end
130
130
 
@@ -4,6 +4,9 @@ require 'json'
4
4
 
5
5
  module LicenseFinder
6
6
  class GoDep < PackageManager
7
+ OLD_GODEP_VENDOR_PATH = 'Godeps/_workspace/src'
8
+ GODEP_VENDOR_PATH = 'vendor'
9
+
7
10
  def initialize(options = {})
8
11
  super
9
12
  @full_version = options[:go_full_version]
@@ -29,16 +32,20 @@ module LicenseFinder
29
32
  private
30
33
 
31
34
  def install_prefix
32
- go_path = if workspace_dir.directory?
33
- workspace_dir
34
- else
35
- Pathname(ENV['GOPATH'] || ENV['HOME'] + '/go')
36
- end
37
- go_path.join('src')
35
+ @install_prefix ||= if project_path.join(OLD_GODEP_VENDOR_PATH).directory?
36
+ project_path.join(OLD_GODEP_VENDOR_PATH)
37
+ elsif project_path.join(GODEP_VENDOR_PATH).directory?
38
+ project_path.join(GODEP_VENDOR_PATH)
39
+ else
40
+ download_dependencies
41
+ Pathname(ENV['GOPATH'] ? ENV['GOPATH'] + '/src' : ENV['HOME'] + '/go/src')
42
+ end
38
43
  end
39
44
 
40
- def workspace_dir
41
- project_path.join('Godeps/_workspace')
45
+ def download_dependencies
46
+ command = "#{package_management_command} restore"
47
+ _, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
48
+ raise "Command '#{command}' failed to execute: #{stderr}" if !status.success? && status.exitstatus != 1
42
49
  end
43
50
 
44
51
  def packages_from_json(json_string)
@@ -55,7 +55,9 @@ module LicenseFinder
55
55
  # TODO: Figure out a way to make the vendor directory work (i.e. remove the
56
56
  # -mod=readonly flag). Each of the imported packages gets listed separatly,
57
57
  # confusing the issue as to which package is the root of the module.
58
- info_output, _stderr, _status = Cmd.run("GO111MODULE=on go list -mod=readonly -deps -f '#{format_str}' ./...")
58
+ go_list_cmd = "GO111MODULE=on go list -mod=readonly -deps -f '#{format_str}' ./..."
59
+ info_output, stderr, status = Cmd.run(go_list_cmd)
60
+ log_errors_with_cmd(go_list_cmd, "Getting the dependencies from go list failed \n\t#{stderr}") unless status.success?
59
61
 
60
62
  # Since many packages may belong to a single module, #uniq is used to deduplicate
61
63
  info_output.split("\n").uniq
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: 6.8.2
4
+ version: 6.9.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: 2020-09-08 00:00:00.000000000 Z
30
+ date: 2020-10-05 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: bundler