licensee 9.15.3 → 9.16.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/bin/licensee +4 -0
  3. data/lib/licensee/content_helper.rb +6 -5
  4. data/lib/licensee/license.rb +10 -2
  5. data/lib/licensee/version.rb +1 -1
  6. data/licensee.gemspec +1 -1
  7. data/spec/fixture_spec.rb +1 -1
  8. data/spec/fixtures/agpl-3.0_markdown/LICENSE.md +651 -0
  9. data/spec/fixtures/apache-2.0_markdown/LICENSE.md +195 -0
  10. data/spec/fixtures/{markdown-artistic → artistic-2.0_markdown}/LICENSE.md +0 -0
  11. data/spec/fixtures/bsd-2-author/LICENSE +22 -0
  12. data/spec/fixtures/bsd-3-clause_markdown/LICENSE.md +28 -0
  13. data/spec/fixtures/cc-by-4.0_markdown/LICENSE.md +157 -0
  14. data/spec/fixtures/cc-by-sa-4.0_markdown/LICENSE.md +171 -0
  15. data/spec/fixtures/cc0-1.0_markdown/LICENSE.md +41 -0
  16. data/spec/fixtures/detect.json +1 -1
  17. data/spec/fixtures/epl-1.0_markdown/LICENSE.md +76 -0
  18. data/spec/fixtures/fixtures.yml +105 -41
  19. data/spec/fixtures/gfdl-1.3_markdown/LICENSE.md +450 -0
  20. data/spec/fixtures/gpl-2.0_markdown/LICENSE.md +336 -0
  21. data/spec/fixtures/{markdown-gpl → gpl-2.0_markdown_headings}/LICENSE.md +0 -0
  22. data/spec/fixtures/gpl-3.0_markdown/LICENSE.md +595 -0
  23. data/spec/fixtures/lgpl-2.1_markdown/LICENSE.md +494 -0
  24. data/spec/fixtures/lgpl-3.0_markdown/LICENSE.md +163 -0
  25. data/spec/fixtures/license-hashes.json +6 -6
  26. data/spec/fixtures/mit_markdown/LICENSE.md +26 -0
  27. data/spec/fixtures/mpl-2.0_markdown/LICENSE.md +357 -0
  28. data/spec/fixtures/unlicense_markdown/LICENSE.md +27 -0
  29. data/spec/integration_spec.rb +11 -2
  30. data/spec/licensee/commands/detect_spec.rb +16 -0
  31. data/spec/licensee/content_helper_spec.rb +16 -0
  32. data/spec/licensee/matchers/reference_matcher_spec.rb +17 -0
  33. data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +1 -0
  34. data/vendor/license-list-XML/src/Artistic-2.0.xml +5 -3
  35. data/vendor/license-list-XML/src/BSD-3-Clause-Clear.xml +3 -1
  36. metadata +22 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6b54db113cb4f1c4933826886afe3ed5e4b66d757a97df74dc43dbb2f8d6bc7
4
- data.tar.gz: 72fa1baf7073bfb9132823d1953977ab49618d03320694647d6947b66aee311f
3
+ metadata.gz: a971ca02733f55d37c599851a056742f8c40d758744c252c778c245082db6b3c
4
+ data.tar.gz: 5cd7c9da75de50b045a68510cb9ab9442029f4a5ce3ae7011438686161de1c03
5
5
  SHA512:
6
- metadata.gz: 461a7ed0479855f6e2c08353ee902b2b8f53661d24161ef22f6c7dbb0f9db1ee375f6fc4e196d1c266cd5830221525af471c9158b64891fa4b0b0b7b373e6eac
7
- data.tar.gz: '09bfdd2cb1d12bd2b4a32bad1de90c65058d9ab1f3ed98ccb94ed9657b8965e236d4be84ce32e7801edf071de3ca7154d34455bfa749d29b1d89d9030c9a0ca4'
6
+ metadata.gz: be105dd2fee2e5e81d340be6692deb0119d3fa478732f0802b70a36f1e93994922c2c3b2567dee6518b53be75af4f7bc520addd472c791786337332bed386cd9
7
+ data.tar.gz: f53af3d80fd536f46767ae2316df97411b4aa4483dd3bf80f5bb3ee3ba39f5334e4c9b5276338b9d00f378347ba503ea8f804102573a32b73699ac98a1c5ec8f
data/bin/licensee CHANGED
@@ -12,6 +12,10 @@ class LicenseeCLI < Thor
12
12
  class_option :remote, type: :boolean, desc: 'Assume PATH is a GitHub owner/repo path'
13
13
  default_task :detect
14
14
 
15
+ def self.exit_on_failure?
16
+ true
17
+ end
18
+
15
19
  private
16
20
 
17
21
  def path
@@ -32,11 +32,12 @@ module Licensee
32
32
  mit_optional: /\(including the next paragraph\)/i
33
33
  }.freeze
34
34
  NORMALIZATIONS = {
35
- lists: { from: /^\s*(?:\d\.|\*)\s+([^\n])/, to: '- \1' },
35
+ lists: { from: /^\s*(?:\d\.|[*-])(?: [*_]{0,2}\(?[\da-z]\)[*_]{0,2})?\s+([^\n])/, to: '- \1' },
36
36
  https: { from: /http:/, to: 'https:' },
37
37
  ampersands: { from: '&', to: 'and' },
38
38
  dashes: { from: /(?<!^)([—–-]+)(?!$)/, to: '-' },
39
- quote: { from: /[`'"‘“’”]/, to: "'" }
39
+ quote: { from: /[`'"‘“’”]/, to: "'" },
40
+ hyphenated: { from: /(\w+)-\s*\n\s*(\w+)/, to: '\1-\2' }
40
41
  }.freeze
41
42
 
42
43
  # Legally equivalent words that schould be ignored for comparison
@@ -82,8 +83,8 @@ module Licensee
82
83
  'whilst' => 'while',
83
84
  'wilful' => 'wilfull',
84
85
  'non-commercial' => 'noncommercial',
85
- 'cent' => 'percent',
86
- 'owner' => 'holder'
86
+ 'per cent' => 'percent',
87
+ 'copyright owner' => 'copyright holder'
87
88
  }.freeze
88
89
  STRIP_METHODS = %i[
89
90
  bom
@@ -341,7 +342,7 @@ module Licensee
341
342
  # Use that if it's present, otherwise, just return the simple delta.
342
343
  return delta unless respond_to?(:spdx_alt_segments, true)
343
344
 
344
- adjusted_delta = delta - ([fields_normalized.size, spdx_alt_segments].max * 4)
345
+ adjusted_delta = delta - ([fields_normalized.size, spdx_alt_segments].max * 5)
345
346
  adjusted_delta.positive? ? adjusted_delta : 0
346
347
  end
347
348
  end
@@ -74,7 +74,7 @@ module Licensee
74
74
  end
75
75
 
76
76
  def keys_licenses(options = {})
77
- @keys_licenses[options] ||= all(options).map { |l| [l.key, l] }.to_h
77
+ @keys_licenses[options] ||= all(options).to_h { |l| [l.key, l] }
78
78
  end
79
79
  end
80
80
 
@@ -151,7 +151,15 @@ module Licensee
151
151
  string.sub!(/v(\d+\.\d+)/, '\1')
152
152
  string = Regexp.escape(string)
153
153
  string = string.sub(/\\ licen[sc]e/i, '(?:\ licen[sc]e)?')
154
- string = string.sub(/\\ (\d+\\.\d+)/, ',?\s+(?:version\ |v(?:\. )?)?\1')
154
+ version_match = string.match(/\d+\\.(\d+)/)
155
+ if version_match
156
+ vsub = if version_match[1] == '0'
157
+ ',?\s+(?:version\ |v(?:\. )?)?\1(\2)?'
158
+ else
159
+ ',?\s+(?:version\ |v(?:\. )?)?\1\2'
160
+ end
161
+ string = string.sub(/\\ (\d+)(\\.\d+)/, vsub)
162
+ end
155
163
  string = string.sub(/\bgnu\\ /, '(?:GNU )?')
156
164
  title_regex = Regexp.new string, 'i'
157
165
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Licensee
4
- VERSION = '9.15.3'
4
+ VERSION = '9.16.0'
5
5
  end
data/licensee.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |gem|
37
37
  gem.add_development_dependency('simplecov', '~> 0.16')
38
38
  gem.add_development_dependency('webmock', '~> 3.1')
39
39
 
40
- gem.required_ruby_version = '>= 2.5'
40
+ gem.required_ruby_version = '>= 2.6'
41
41
 
42
42
  # ensure the gem is built out of versioned files
43
43
  gem.files = Dir[
data/spec/fixture_spec.rb CHANGED
@@ -33,7 +33,7 @@ RSpec.describe 'fixture test' do
33
33
  end
34
34
 
35
35
  it 'returns the expected hash' do
36
- hash = license_file ? license_file.content_hash : nil
36
+ hash = license_file&.content_hash
37
37
  expect(hash).to eql(expectations['hash'])
38
38
  end
39
39