license_finder 6.1.2 → 6.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/CHANGELOG.md +64 -0
  4. data/Dockerfile +23 -15
  5. data/README.md +24 -2
  6. data/Rakefile +1 -1
  7. data/VERSION +1 -1
  8. data/ci/pipelines/release.yml.erb +8 -19
  9. data/ci/scripts/pushscript.sh +1 -1
  10. data/ci/scripts/updateChangelog.sh +8 -1
  11. data/ci/tasks/build-and-push-gem.yml +2 -2
  12. data/ci/tasks/rubocop.yml +1 -1
  13. data/ci/tasks/update-changelog.yml +2 -2
  14. data/lib/license_finder/cli.rb +1 -0
  15. data/lib/license_finder/cli/base.rb +1 -0
  16. data/lib/license_finder/cli/inherited_decisions.rb +32 -0
  17. data/lib/license_finder/cli/main.rb +3 -1
  18. data/lib/license_finder/configuration.rb +4 -0
  19. data/lib/license_finder/decision_applier.rb +8 -4
  20. data/lib/license_finder/decisions.rb +63 -20
  21. data/lib/license_finder/license/definitions.rb +48 -1
  22. data/lib/license_finder/license/templates/0BSD.txt +10 -0
  23. data/lib/license_finder/license/templates/OFL.txt +91 -0
  24. data/lib/license_finder/license/templates/SimplifiedBSD.txt +0 -4
  25. data/lib/license_finder/license/templates/WTFPL.txt +14 -0
  26. data/lib/license_finder/license/text.rb +24 -2
  27. data/lib/license_finder/logger.rb +2 -0
  28. data/lib/license_finder/package.rb +2 -1
  29. data/lib/license_finder/package_manager.rb +6 -2
  30. data/lib/license_finder/package_managers/bundler.rb +5 -3
  31. data/lib/license_finder/package_managers/cargo.rb +2 -1
  32. data/lib/license_finder/package_managers/composer.rb +5 -1
  33. data/lib/license_finder/package_managers/dep.rb +2 -2
  34. data/lib/license_finder/package_managers/dotnet.rb +2 -1
  35. data/lib/license_finder/package_managers/glide.rb +2 -7
  36. data/lib/license_finder/package_managers/go_15vendorexperiment.rb +1 -1
  37. data/lib/license_finder/package_managers/go_modules.rb +11 -4
  38. data/lib/license_finder/package_managers/go_workspace.rb +5 -1
  39. data/lib/license_finder/package_managers/nuget.rb +37 -3
  40. data/lib/license_finder/package_managers/pipenv.rb +1 -1
  41. data/lib/license_finder/package_managers/sbt.rb +3 -1
  42. data/lib/license_finder/package_managers/yarn.rb +16 -2
  43. data/lib/license_finder/package_utils/license_files.rb +2 -2
  44. data/lib/license_finder/packages/bower_package.rb +7 -0
  45. data/lib/license_finder/packages/bundler_package.rb +4 -0
  46. data/lib/license_finder/packages/cargo_package.rb +4 -0
  47. data/lib/license_finder/packages/cocoa_pods_package.rb +4 -0
  48. data/lib/license_finder/packages/composer_package.rb +4 -0
  49. data/lib/license_finder/packages/conan_package.rb +4 -0
  50. data/lib/license_finder/packages/go_package.rb +5 -1
  51. data/lib/license_finder/packages/gradle_package.rb +4 -0
  52. data/lib/license_finder/packages/maven_package.rb +6 -1
  53. data/lib/license_finder/packages/merged_package.rb +1 -1
  54. data/lib/license_finder/packages/mix_package.rb +4 -0
  55. data/lib/license_finder/packages/npm_package.rb +4 -0
  56. data/lib/license_finder/packages/nuget_package.rb +4 -0
  57. data/lib/license_finder/packages/pip_package.rb +4 -0
  58. data/lib/license_finder/packages/rebar_package.rb +4 -0
  59. data/lib/license_finder/packages/yarn_package.rb +4 -0
  60. data/lib/license_finder/reports/csv_report.rb +7 -3
  61. data/lib/license_finder/reports/json_report.rb +2 -0
  62. data/license_finder.gemspec +5 -5
  63. metadata +20 -22
@@ -15,5 +15,9 @@ module LicenseFinder
15
15
  def package_manager
16
16
  'Conan'
17
17
  end
18
+
19
+ def package_url
20
+ "https://conan.io/center/#{CGI.escape(name)}/#{CGI.escape(version)}"
21
+ end
18
22
  end
19
23
  end
@@ -8,12 +8,16 @@ module LicenseFinder
8
8
  'Go'
9
9
  end
10
10
 
11
+ def package_url
12
+ "https://pkg.go.dev/#{CGI.escape(name)}@#{CGI.escape(version)}"
13
+ end
14
+
11
15
  class << self
12
16
  def from_dependency(hash, prefix, full_version)
13
17
  name = hash['ImportPath']
14
18
  install_path = hash['InstallPath']
15
19
  install_path ||= install_path(prefix.join(name))
16
- version = full_version ? hash['Rev'] : hash['Rev'][0..6]
20
+ version = full_version ? hash['Rev'].gsub('+incompatible', '') : hash['Rev'][0..6]
17
21
  homepage = hash['Homepage']
18
22
  new(name, version, install_path: install_path, package_manager: 'Go', homepage: homepage)
19
23
  end
@@ -22,5 +22,9 @@ module LicenseFinder
22
22
  def package_manager
23
23
  'Gradle'
24
24
  end
25
+
26
+ def package_url
27
+ "https://plugins.gradle.org/plugin/#{CGI.escape(name)}/#{CGI.escape(version)}"
28
+ end
25
29
  end
26
30
  end
@@ -10,7 +10,8 @@ module LicenseFinder
10
10
  name,
11
11
  spec['version'],
12
12
  options.merge(
13
- spec_licenses: Array(spec['licenses']).map { |l| l['name'] }
13
+ spec_licenses: Array(spec['licenses']).map { |l| l['name'] },
14
+ groups: Array(spec['groupId'])
14
15
  )
15
16
  )
16
17
  end
@@ -18,5 +19,9 @@ module LicenseFinder
18
19
  def package_manager
19
20
  'Maven'
20
21
  end
22
+
23
+ def package_url
24
+ "https://search.maven.org/artifact/#{CGI.escape(groups.first)}/#{CGI.escape(name.split(':').last)}/#{CGI.escape(version)}/jar"
25
+ end
21
26
  end
22
27
  end
@@ -11,7 +11,7 @@ module LicenseFinder
11
11
  super(package.name, package.version)
12
12
  end
13
13
 
14
- def_delegators :@dependency, :name, :version, :authors, :summary, :description, :homepage, :children, :parents,
14
+ def_delegators :@dependency, :name, :version, :authors, :summary, :description, :homepage, :package_url, :children, :parents,
15
15
  :groups, :permitted, :restricted, :manual_approval, :install_path, :licenses, :approved_manually?,
16
16
  :approved_manually!, :approved?, :permitted!, :permitted?, :restricted!, :restricted?, :hash,
17
17
  :activations, :missing, :license_names_from_spec, :decided_licenses, :licensing, :decide_on_license,
@@ -5,5 +5,9 @@ module LicenseFinder
5
5
  def package_manager
6
6
  'Mix'
7
7
  end
8
+
9
+ def package_url
10
+ "https://hex.pm/packages/#{CGI.escape(name)}/#{CGI.escape(version)}"
11
+ end
8
12
  end
9
13
  end
@@ -89,6 +89,10 @@ module LicenseFinder
89
89
  'Npm'
90
90
  end
91
91
 
92
+ def package_url
93
+ "https://www.npmjs.com/package/#{CGI.escape(name)}/v/#{CGI.escape(version)}"
94
+ end
95
+
92
96
  private
93
97
 
94
98
  def deps_from_json
@@ -5,5 +5,9 @@ module LicenseFinder
5
5
  def package_manager
6
6
  'Nuget'
7
7
  end
8
+
9
+ def package_url
10
+ "https://www.nuget.org/packages/#{CGI.escape(name)}/#{CGI.escape(version)}"
11
+ end
8
12
  end
9
13
  end
@@ -35,5 +35,9 @@ module LicenseFinder
35
35
  def package_manager
36
36
  'Pip'
37
37
  end
38
+
39
+ def package_url
40
+ "https://pypi.org/project/#{CGI.escape(name)}/#{CGI.escape(version)}/"
41
+ end
38
42
  end
39
43
  end
@@ -5,5 +5,9 @@ module LicenseFinder
5
5
  def package_manager
6
6
  'Rebar'
7
7
  end
8
+
9
+ def package_url
10
+ "https://hex.pm/packages/#{CGI.escape(name)}/#{CGI.escape(version)}"
11
+ end
8
12
  end
9
13
  end
@@ -5,5 +5,9 @@ module LicenseFinder
5
5
  def package_manager
6
6
  'Yarn'
7
7
  end
8
+
9
+ def package_url
10
+ "https://yarn.pm/#{CGI.escape(name)}"
11
+ end
8
12
  end
9
13
  end
@@ -3,6 +3,7 @@ require 'csv'
3
3
  module LicenseFinder
4
4
  class CsvReport < Report
5
5
  COMMA_SEP = ','.freeze
6
+ NEWLINE_SEP = '\@NL'.freeze
6
7
  AVAILABLE_COLUMNS = %w[name version authors licenses license_links approved summary description homepage install_path package_manager groups texts notice].freeze
7
8
  MISSING_DEPENDENCY_TEXT = 'This package is not installed. Please install to determine licenses.'.freeze
8
9
 
@@ -10,10 +11,11 @@ module LicenseFinder
10
11
  super
11
12
  options[:columns] ||= %w[name version licenses]
12
13
  @columns = Array(options[:columns]) & self.class::AVAILABLE_COLUMNS
14
+ @write_headers = options[:write_headers] || false
13
15
  end
14
16
 
15
17
  def to_s
16
- CSV.generate(col_sep: self.class::COMMA_SEP) do |csv|
18
+ CSV.generate(col_sep: self.class::COMMA_SEP, headers: @columns, write_headers: @write_headers) do |csv|
17
19
  sorted_dependencies.each do |s|
18
20
  csv << format_dependency(s)
19
21
  end
@@ -29,11 +31,13 @@ module LicenseFinder
29
31
  end
30
32
 
31
33
  def format_texts(dep)
32
- dep.license_files.map { |file| file.text.split(/[\n\r]+/).join("\\@NL") }.join("\\@NL").force_encoding("ISO-8859-1").encode("UTF-8")
34
+ dep.license_files.map { |file| file.text.split(/[\n\r]+/).join(self.class::NEWLINE_SEP) }
35
+ .join(self.class::NEWLINE_SEP).force_encoding("ISO-8859-1").encode("UTF-8")
33
36
  end
34
37
 
35
38
  def format_notice(dep)
36
- dep.notice_files.map { |file| file.text.split(/[\n\r]+/).join("\\@NL") }.join("\\@NL").force_encoding("ISO-8859-1").encode("UTF-8")
39
+ dep.notice_files.map { |file| file.text.split(/[\n\r]+/).join(self.class::NEWLINE_SEP) }
40
+ .join(self.class::NEWLINE_SEP).force_encoding("ISO-8859-1").encode("UTF-8")
37
41
  end
38
42
 
39
43
  def format_name(dep)
@@ -2,6 +2,8 @@ require 'csv'
2
2
 
3
3
  module LicenseFinder
4
4
  class JsonReport < CsvReport
5
+ NEWLINE_SEP = "\n".freeze
6
+
5
7
  def initialize(dependencies, options)
6
8
  super(dependencies, options)
7
9
  end
@@ -46,24 +46,24 @@ Gem::Specification.new do |s|
46
46
  s.add_dependency 'bundler'
47
47
  s.add_dependency 'rubyzip', '>=1', '<3'
48
48
  s.add_dependency 'thor', '~> 1.0.1'
49
- s.add_dependency 'toml', '0.2.0'
49
+ s.add_dependency 'tomlrb', '~> 1.3.0'
50
50
  s.add_dependency 'with_env', '1.1.0'
51
51
  s.add_dependency 'xml-simple', '~> 1.1.5'
52
52
 
53
53
  s.add_development_dependency 'addressable', '2.7.0'
54
54
  s.add_development_dependency 'capybara', '~> 3.15.0'
55
55
  s.add_development_dependency 'cocoapods', '>= 1.0.0' if RUBY_PLATFORM =~ /darwin/
56
- s.add_development_dependency 'fakefs', '~> 1.0.0'
56
+ s.add_development_dependency 'fakefs', '~> 1.2.0'
57
57
  s.add_development_dependency 'mime-types', '3.3.1'
58
- s.add_development_dependency 'pry', '~> 0.12.2'
58
+ s.add_development_dependency 'pry', '~> 0.13.0'
59
59
  s.add_development_dependency 'rake', '~> 13.0.1'
60
60
  s.add_development_dependency 'rspec', '~> 3'
61
61
  s.add_development_dependency 'rspec-its', '~> 1.3.0'
62
- s.add_development_dependency 'rubocop', '~> 0.79.0'
62
+ s.add_development_dependency 'rubocop', '~> 0.81.0'
63
63
  s.add_development_dependency 'rubocop-performance', '~> 1.5.0'
64
64
  s.add_development_dependency 'webmock', '~> 3.5'
65
65
 
66
- s.add_development_dependency 'rack', '~> 2.0.7', '> 1.6'
66
+ s.add_development_dependency 'rack', '~> 2.2.2'
67
67
  s.add_development_dependency 'rack-test', '~> 1.1.0', '> 0.7'
68
68
 
69
69
  s.files = `git ls-files`.split("\n").reject { |f| f.start_with?('spec', 'features') }
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.1.2
4
+ version: 6.6.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-03-16 00:00:00.000000000 Z
30
+ date: 2020-06-22 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: bundler
@@ -78,19 +78,19 @@ dependencies:
78
78
  - !ruby/object:Gem::Version
79
79
  version: 1.0.1
80
80
  - !ruby/object:Gem::Dependency
81
- name: toml
81
+ name: tomlrb
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '='
84
+ - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: 0.2.0
86
+ version: 1.3.0
87
87
  type: :runtime
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '='
91
+ - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: 0.2.0
93
+ version: 1.3.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: with_env
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -153,14 +153,14 @@ dependencies:
153
153
  requirements:
154
154
  - - "~>"
155
155
  - !ruby/object:Gem::Version
156
- version: 1.0.0
156
+ version: 1.2.0
157
157
  type: :development
158
158
  prerelease: false
159
159
  version_requirements: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - "~>"
162
162
  - !ruby/object:Gem::Version
163
- version: 1.0.0
163
+ version: 1.2.0
164
164
  - !ruby/object:Gem::Dependency
165
165
  name: mime-types
166
166
  requirement: !ruby/object:Gem::Requirement
@@ -181,14 +181,14 @@ dependencies:
181
181
  requirements:
182
182
  - - "~>"
183
183
  - !ruby/object:Gem::Version
184
- version: 0.12.2
184
+ version: 0.13.0
185
185
  type: :development
186
186
  prerelease: false
187
187
  version_requirements: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - "~>"
190
190
  - !ruby/object:Gem::Version
191
- version: 0.12.2
191
+ version: 0.13.0
192
192
  - !ruby/object:Gem::Dependency
193
193
  name: rake
194
194
  requirement: !ruby/object:Gem::Requirement
@@ -237,14 +237,14 @@ dependencies:
237
237
  requirements:
238
238
  - - "~>"
239
239
  - !ruby/object:Gem::Version
240
- version: 0.79.0
240
+ version: 0.81.0
241
241
  type: :development
242
242
  prerelease: false
243
243
  version_requirements: !ruby/object:Gem::Requirement
244
244
  requirements:
245
245
  - - "~>"
246
246
  - !ruby/object:Gem::Version
247
- version: 0.79.0
247
+ version: 0.81.0
248
248
  - !ruby/object:Gem::Dependency
249
249
  name: rubocop-performance
250
250
  requirement: !ruby/object:Gem::Requirement
@@ -279,20 +279,14 @@ dependencies:
279
279
  requirements:
280
280
  - - "~>"
281
281
  - !ruby/object:Gem::Version
282
- version: 2.0.7
283
- - - ">"
284
- - !ruby/object:Gem::Version
285
- version: '1.6'
282
+ version: 2.2.2
286
283
  type: :development
287
284
  prerelease: false
288
285
  version_requirements: !ruby/object:Gem::Requirement
289
286
  requirements:
290
287
  - - "~>"
291
288
  - !ruby/object:Gem::Version
292
- version: 2.0.7
293
- - - ">"
294
- - !ruby/object:Gem::Version
295
- version: '1.6'
289
+ version: 2.2.2
296
290
  - !ruby/object:Gem::Dependency
297
291
  name: rack-test
298
292
  requirement: !ruby/object:Gem::Requirement
@@ -364,6 +358,7 @@ files:
364
358
  - lib/license_finder/cli/dependencies.rb
365
359
  - lib/license_finder/cli/ignored_dependencies.rb
366
360
  - lib/license_finder/cli/ignored_groups.rb
361
+ - lib/license_finder/cli/inherited_decisions.rb
367
362
  - lib/license_finder/cli/licenses.rb
368
363
  - lib/license_finder/cli/main.rb
369
364
  - lib/license_finder/cli/makes_decisions.rb
@@ -384,6 +379,7 @@ files:
384
379
  - lib/license_finder/license/matcher.rb
385
380
  - lib/license_finder/license/none_matcher.rb
386
381
  - lib/license_finder/license/template.rb
382
+ - lib/license_finder/license/templates/0BSD.txt
387
383
  - lib/license_finder/license/templates/Apache1_1.txt
388
384
  - lib/license_finder/license/templates/Apache2.txt
389
385
  - lib/license_finder/license/templates/BSD.txt
@@ -398,9 +394,11 @@ files:
398
394
  - lib/license_finder/license/templates/MIT.txt
399
395
  - lib/license_finder/license/templates/MPL2.txt
400
396
  - lib/license_finder/license/templates/NewBSD.txt
397
+ - lib/license_finder/license/templates/OFL.txt
401
398
  - lib/license_finder/license/templates/Python.txt
402
399
  - lib/license_finder/license/templates/Ruby.txt
403
400
  - lib/license_finder/license/templates/SimplifiedBSD.txt
401
+ - lib/license_finder/license/templates/WTFPL.txt
404
402
  - lib/license_finder/license/text.rb
405
403
  - lib/license_finder/license_aggregator.rb
406
404
  - lib/license_finder/logger.rb
@@ -504,7 +502,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
504
502
  - !ruby/object:Gem::Version
505
503
  version: '0'
506
504
  requirements: []
507
- rubygems_version: 3.1.2
505
+ rubygems_version: 3.1.4
508
506
  signing_key:
509
507
  specification_version: 4
510
508
  summary: Audit the OSS licenses of your application's dependencies.