license_scout 1.0.29 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98affa41f1e7d2f49e16775cae3fd695483356468d82a1582af56ae3fe954cda
4
- data.tar.gz: 24d62cf2471af0eeef5f3d80dc374390e482489ce5bac596a4f0767719d03ddc
3
+ metadata.gz: d9c5e321c74710d7d89511951ef0c8ded06a81ed6c9d2084fc27f63628520963
4
+ data.tar.gz: d70c4aa848283c9335a896cbdfc5ac376dba45c37beaafe3c423f6dd9ee30b78
5
5
  SHA512:
6
- metadata.gz: 9dbadf051bf66fd9c9eb26872cb4ddf1ced77c21aaec10912bf5f06be3a7faa15bbf4cceca9d8ae9a82e147229a8f70bab3113e1cdc6e53973cb69a28aeff40a
7
- data.tar.gz: 5d68473b3aaf6ac1e6fa668e46faabb1ca69936883dd8e46596dd9840a2b1cc90c2b3631234cb2372f63316e283442c59ad278a77939c5d5d34c0311a8acacc1
6
+ metadata.gz: a5e20c76b3f00a65c3e429beb824068c0c4f3dfa4ebf41cab677fa5c0221d8fa5846fb333fc6fc09d0e73252b50cfdba1c78e2634e4ed46f7bb979d760173e7a
7
+ data.tar.gz: 0e3f7b9f1415b2b3e7aa8c7132e7edf1d1444bb0563fae1c293e00e33b4869859667bc174b528a428dfe184f770593d193de5653865f0cd58969f8cb047035d8
data/bin/license_scout CHANGED
@@ -41,38 +41,38 @@ report = collector.issue_report
41
41
  unless report.empty?
42
42
  puts report
43
43
 
44
- puts <<-EXPLANATION
45
-
46
- How to fix this depends on what information license_scout was unable to
47
- determine:
48
-
49
- * If the package is missing license information, that means license_scout was
50
- unable to determine which license the package was released under. Depending
51
- on the package manager, this is usually specified in the package's metadata,
52
- for example, in the gemspec file for rubygems or in the package.json for npm.
53
- If you know which license a package was released under, MIT for example, you
54
- can add an override in license_scout's overrides.rb file in the section for
55
- the appropriate package manager like this:
56
- ["package-name", "MIT", nil]
57
-
58
- * If the package is missing the license file, that means license_scout could not
59
- find the license text in any of the places the license is typically found, for
60
- example, in a file named LICENSE in the root of the package. If the package
61
- includes the license text in a non standard location or in its source repo,
62
- you can indicate this by adding an override in license_scout's overrides.rb
63
- file in the section for the appropriate package manager like this:
64
- ["package-name", nil, ["https://example.com/foocorp/package-name/master/LICENSE"]],
65
-
66
- If you know that the package was released under one of the common software
67
- licenses, MIT for example, but does not include the license text in packaged
68
- releases or in its source repo, you can add an override in license_scout's
69
- overrides.rb file in the section for the appropriate package manager like
70
- this:
71
- ["package-name", nil, [canonical("MIT")]]
72
-
73
- See the closed pull requests on the license_scout repo for examples of how to
74
- do this:
75
- https://github.com/chef/license_scout/pulls?q=is%3Apr+is%3Aclosed
44
+ puts <<~EXPLANATION
45
+
46
+ How to fix this depends on what information license_scout was unable to
47
+ determine:
48
+
49
+ * If the package is missing license information, that means license_scout was
50
+ unable to determine which license the package was released under. Depending
51
+ on the package manager, this is usually specified in the package's metadata,
52
+ for example, in the gemspec file for rubygems or in the package.json for npm.
53
+ If you know which license a package was released under, MIT for example, you
54
+ can add an override in license_scout's overrides.rb file in the section for
55
+ the appropriate package manager like this:
56
+ ["package-name", "MIT", nil]
57
+
58
+ * If the package is missing the license file, that means license_scout could not
59
+ find the license text in any of the places the license is typically found, for
60
+ example, in a file named LICENSE in the root of the package. If the package
61
+ includes the license text in a non standard location or in its source repo,
62
+ you can indicate this by adding an override in license_scout's overrides.rb
63
+ file in the section for the appropriate package manager like this:
64
+ ["package-name", nil, ["https://example.com/foocorp/package-name/master/LICENSE"]],
65
+
66
+ If you know that the package was released under one of the common software
67
+ licenses, MIT for example, but does not include the license text in packaged
68
+ releases or in its source repo, you can add an override in license_scout's
69
+ overrides.rb file in the section for the appropriate package manager like
70
+ this:
71
+ ["package-name", nil, [canonical("MIT")]]
72
+
73
+ See the closed pull requests on the license_scout repo for examples of how to
74
+ do this:
75
+ https://github.com/chef/license_scout/pulls?q=is%3Apr+is%3Aclosed
76
76
  EXPLANATION
77
77
 
78
78
  exit 2
@@ -38,20 +38,22 @@ module LicenseScout
38
38
  end
39
39
 
40
40
  def dependency_managers
41
- @dependency_managers ||= all_dependency_managers.select { |m| m.detected? }
41
+ @dependency_managers ||= all_dependency_managers.select(&:detected?)
42
42
  end
43
43
 
44
44
  def run
45
45
  reset_license_manifest
46
46
 
47
- if !File.exist?(project_dir)
47
+ unless File.exist?(project_dir)
48
48
  raise LicenseScout::Exceptions::ProjectDirectoryMissing.new(project_dir)
49
49
  end
50
+
50
51
  FileUtils.mkdir_p(output_dir) unless File.exist?(output_dir)
51
52
 
52
53
  if dependency_managers.empty?
53
54
  raise LicenseScout::Exceptions::UnsupportedProjectType.new(project_dir)
54
55
  end
56
+
55
57
  dependency_managers.each { |d| collect_licenses_from(d) }
56
58
 
57
59
  File.open(license_manifest_path, "w+") do |file|
@@ -19,7 +19,7 @@ module LicenseScout
19
19
  Dependency = Struct.new(:name, :version, :license, :license_files, :dep_mgr_name) do
20
20
 
21
21
  def eql?(other)
22
- other.kind_of?(self.class) && other.hash == hash
22
+ other.is_a?(self.class) && other.hash == hash
23
23
  end
24
24
 
25
25
  # hash code for when Dependency is used as a key in a Hash or member of a
@@ -40,7 +40,7 @@ module LicenseScout
40
40
  end
41
41
 
42
42
  def dependencies
43
- if !berkshelf_available?
43
+ unless berkshelf_available?
44
44
  raise LicenseScout::Exceptions::Error.new "Project at '#{project_dir}' is a Berkshelf project but berkshelf gem is not available in your bundle. Add berkshelf to your bundle in order to collect licenses for this project."
45
45
  end
46
46
 
@@ -30,11 +30,11 @@ module LicenseScout
30
30
  class CpanmDependency
31
31
 
32
32
  LICENSE_TYPE_MAP = {
33
- "perl_5" => "Perl-5",
34
- "perl" => "Perl-5",
35
- "apache_2_0" => "Apache-2.0",
36
- "artistic_2" => "Artistic-2.0",
37
- "gpl_3" => "GPL-3.0",
33
+ "perl_5" => "Perl-5",
34
+ "perl" => "Perl-5",
35
+ "apache_2_0" => "Apache-2.0",
36
+ "artistic_2" => "Artistic-2.0",
37
+ "gpl_3" => "GPL-3.0",
38
38
  }.freeze
39
39
 
40
40
  attr_reader :unpack_path
@@ -38,6 +38,7 @@ module LicenseScout
38
38
  TomlRB.parse(f)
39
39
  end
40
40
  return [] unless deps.key?("projects")
41
+
41
42
  deps["projects"].map do |pkg_info|
42
43
  pkg_import_name = pkg_info["name"]
43
44
  pkg_file_name = pkg_import_name.tr("/", "_")
@@ -71,7 +72,7 @@ module LicenseScout
71
72
  end
72
73
 
73
74
  def gopath(pkg)
74
- "#{ENV['GOPATH']}/src/#{pkg}"
75
+ "#{ENV["GOPATH"]}/src/#{pkg}"
75
76
  end
76
77
 
77
78
  def vendor_dir(pkg = nil)
@@ -67,7 +67,7 @@ module LicenseScout
67
67
  end
68
68
 
69
69
  def gopath(pkg)
70
- "#{ENV['GOPATH']}/src/#{pkg}"
70
+ "#{ENV["GOPATH"]}/src/#{pkg}"
71
71
  end
72
72
 
73
73
  def find_license_files_for_package_in_gopath(pkg)
@@ -59,7 +59,7 @@ module LicenseScout
59
59
  end
60
60
 
61
61
  def gopath(pkg)
62
- "#{ENV['GOPATH']}/src/#{pkg}"
62
+ "#{ENV["GOPATH"]}/src/#{pkg}"
63
63
  end
64
64
 
65
65
  def find_license_files_for_package_in_gopath(pkg)
@@ -50,13 +50,13 @@ module LicenseScout
50
50
  end
51
51
 
52
52
  def validate_input!
53
- if !options.manual_licenses.is_a?(Array)
53
+ unless options.manual_licenses.is_a?(Array)
54
54
  raise LicenseScout::Exceptions::InvalidManualDependency.new("Invalid manual dependency is specified. :manual_licenses should be an Array in options.")
55
55
  end
56
56
 
57
57
  options.manual_licenses.each do |l|
58
58
  l.keys.each do |k|
59
- if ![:name, :version, :license, :license_files, :dependency_manager].include?(k)
59
+ unless %i{name version license license_files dependency_manager}.include?(k)
60
60
  raise LicenseScout::Exceptions::InvalidManualDependency.new("Invalid manual dependency is specified. Key '#{k}' is not supported.")
61
61
  end
62
62
  end
@@ -113,7 +113,7 @@ module LicenseScout
113
113
  when Hash
114
114
  license_metadata["type"]
115
115
  when Array
116
- if (map = license_metadata.first) && map.kind_of?(Hash) && (type = map["type"])
116
+ if (map = license_metadata.first) && map.is_a?(Hash) && (type = map["type"])
117
117
  type
118
118
  else
119
119
  nil
@@ -129,6 +129,7 @@ module LicenseScout
129
129
  # If there are multiple options, we want to pick just one to keep it simple.
130
130
  def select_best_license(license_string)
131
131
  return nil if license_string.nil?
132
+
132
133
  options = license_string.tr("(", "").tr(")", "").split(" OR ")
133
134
  options.inject do |selected_license, license|
134
135
  if license_rank(selected_license) < license_rank(license)
@@ -25,14 +25,14 @@
25
25
  module LicenseScout
26
26
  module LicenseFileAnalyzer
27
27
  module Text
28
- SPACES = /[[:space:]]+/
29
- QUOTES = /['`"]{1,2}/
30
- PLACEHOLDERS = /<[^<>]+>/
28
+ SPACES = /[[:space:]]+/.freeze
29
+ QUOTES = /['`"]{1,2}/.freeze
30
+ PLACEHOLDERS = /<[^<>]+>/.freeze
31
31
 
32
32
  def self.normalize_punctuation(text)
33
33
  text.gsub(SPACES, " ")
34
- .gsub(QUOTES, '"')
35
- .strip
34
+ .gsub(QUOTES, '"')
35
+ .strip
36
36
  end
37
37
 
38
38
  def self.compile_to_regex(text)
@@ -19,7 +19,7 @@ require "license_scout/overrides"
19
19
 
20
20
  module LicenseScout
21
21
  class Options
22
- SUPPORTED_OPTIONS = [:overrides, :environment, :ruby_bin, :cpan_cache, :manual_licenses].freeze
22
+ SUPPORTED_OPTIONS = %i{overrides environment ruby_bin cpan_cache manual_licenses}.freeze
23
23
 
24
24
  SUPPORTED_OPTIONS.each do |o|
25
25
  send(:attr_reader, o)
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2016, Chef Software Inc.
2
+ # Copyright:: Copyright 2016-2020, Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -87,6 +87,7 @@ module LicenseScout
87
87
 
88
88
  def license_data_for(dependency_manager, dependency_name, dependency_version)
89
89
  return nil unless have_override_for?(dependency_manager, dependency_name, dependency_version)
90
+
90
91
  override_rules[dependency_manager][dependency_name].call(dependency_version)
91
92
  end
92
93
 
@@ -416,6 +417,7 @@ module LicenseScout
416
417
  ["word-salad", "MIT", ["https://raw.githubusercontent.com/alexvollmer/word_salad/master/README.txt"]],
417
418
  ["xml-simple", "Ruby", ["https://raw.githubusercontent.com/maik/xml-simple/master/README.md"]],
418
419
  ["zonefile", "MIT", ["https://raw.githubusercontent.com/boesemar/zonefile/master/LICENSE"]],
420
+ ["sync", "BSD-2-Clause", ["https://raw.githubusercontent.com/ruby/sync/blob/master/LICENSE.txt"]],
419
421
  ]
420
422
  (aws_sdk_gems + other_gems).each do |override_data|
421
423
  override_license "ruby_bundler", override_data[0] do |version|
@@ -521,7 +523,7 @@ module LicenseScout
521
523
  ["Variable-Magic", nil, ["README"]],
522
524
  ["Class-Data-Inheritable", nil, ["https://raw.githubusercontent.com/tmtmtmtm/class-data-inheritable/master/README"]],
523
525
  ["File-ShareDir", "Perl-5", ["lib/File/ShareDir.pm"]],
524
- ["TermReadKey", "nil", ["README"]]
526
+ ["TermReadKey", "nil", ["README"]],
525
527
  ].each do |override_data|
526
528
  override_license "perl_cpanm", override_data[0] do |version|
527
529
  {}.tap do |d|
@@ -939,7 +941,7 @@ module LicenseScout
939
941
  ["minipass", "ISC", ["https://raw.githubusercontent.com/isaacs/minipass/master/LICENSE"]],
940
942
  ["npm-bundled", "ISC", ["https://raw.githubusercontent.com/npm/npm-bundled/master/LICENSE"]],
941
943
  ["needle", "MIT", ["https://raw.githubusercontent.com/tomas/needle/master/license.txt"]],
942
- ["uri-js", "BSD-2-Clause", ["https://raw.githubusercontent.com/garycourt/uri-js/master/README.md"]]
944
+ ["uri-js", "BSD-2-Clause", ["https://raw.githubusercontent.com/garycourt/uri-js/master/README.md"]],
943
945
  ].each do |override_data|
944
946
  override_license "js_npm", override_data[0] do |version|
945
947
  {}.tap do |d|
@@ -1058,7 +1060,7 @@ module LicenseScout
1058
1060
  ["github.com/spf13/jwalterweatherman", "MIT", ["https://raw.githubusercontent.com/spf13/jWalterWeatherman/master/LICENSE"]],
1059
1061
  ["github.com/spf13/viper", "MIT", ["https://raw.githubusercontent.com/spf13/viper/master/LICENSE"]],
1060
1062
  ["github.com/satori/go.uuid", "MIT", ["https://raw.githubusercontent.com/satori/go.uuid/master/LICENSE"]],
1061
- ["github.com/teambition/rrule-go", "MIT", ["https://raw.githubusercontent.com/teambition/rrule-go/master/LICENSE"]]
1063
+ ["github.com/teambition/rrule-go", "MIT", ["https://raw.githubusercontent.com/teambition/rrule-go/master/LICENSE"]],
1062
1064
  ].each do |override_data|
1063
1065
  override_license "go", override_data[0] do |version|
1064
1066
  {}.tap do |d|
@@ -76,7 +76,7 @@ module LicenseScout
76
76
  problems << "Dependency '#{dependency["name"]}' version '#{dependency["version"]}' under '#{dependency_manager}' is missing license files information."
77
77
  else
78
78
  dependency["license_files"].each do |license_file|
79
- if !File.exist?(full_path_for(license_file))
79
+ unless File.exist?(full_path_for(license_file))
80
80
  problems << "License file '#{license_file}' for the dependency '#{dependency["name"]}' version '#{dependency["version"]}' under '#{dependency_manager}' is missing."
81
81
  end
82
82
  end
@@ -86,7 +86,7 @@ module LicenseScout
86
86
  end
87
87
 
88
88
  def find_license_manifest!
89
- if !File.exist?(output_directory)
89
+ unless File.exist?(output_directory)
90
90
  raise LicenseScout::Exceptions::InvalidOutputReport.new("Output directory '#{output_directory}' does not exist.")
91
91
  end
92
92
 
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module LicenseScout
19
- VERSION = "1.0.29".freeze
19
+ VERSION = "1.1.2".freeze
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_scout
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.29
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serdar Sutay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-20 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-yajl
@@ -48,16 +48,22 @@ dependencies:
48
48
  name: toml-rb
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '1.0'
53
+ version: '1'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '3'
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '1'
64
+ - - "<"
59
65
  - !ruby/object:Gem::Version
60
- version: '1.0'
66
+ version: '3'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: rake
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
235
  requirements:
230
236
  - - ">="
231
237
  - !ruby/object:Gem::Version
232
- version: '0'
238
+ version: '2.3'
233
239
  required_rubygems_version: !ruby/object:Gem::Requirement
234
240
  requirements:
235
241
  - - ">="