licensee 9.15.2 → 9.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) 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 +11 -3
  5. data/lib/licensee/matchers/copyright.rb +3 -1
  6. data/lib/licensee/matchers/dist_zilla.rb +1 -0
  7. data/lib/licensee/projects/github_project.rb +1 -1
  8. data/lib/licensee/version.rb +1 -1
  9. data/licensee.gemspec +3 -3
  10. data/spec/fixture_spec.rb +1 -1
  11. data/spec/fixtures/agpl-3.0_markdown/LICENSE.md +651 -0
  12. data/spec/fixtures/apache-2.0_markdown/LICENSE.md +195 -0
  13. data/spec/fixtures/{markdown-artistic → artistic-2.0_markdown}/LICENSE.md +0 -0
  14. data/spec/fixtures/bsd-2-author/LICENSE +22 -0
  15. data/spec/fixtures/bsd-3-clause_markdown/LICENSE.md +28 -0
  16. data/spec/fixtures/cc-by-4.0_markdown/LICENSE.md +157 -0
  17. data/spec/fixtures/cc-by-sa-4.0_markdown/LICENSE.md +171 -0
  18. data/spec/fixtures/cc0-1.0_markdown/LICENSE.md +41 -0
  19. data/spec/fixtures/detect.json +2 -2
  20. data/spec/fixtures/epl-1.0_markdown/LICENSE.md +76 -0
  21. data/spec/fixtures/fixtures.yml +105 -41
  22. data/spec/fixtures/gfdl-1.3_markdown/LICENSE.md +450 -0
  23. data/spec/fixtures/gpl-2.0_markdown/LICENSE.md +336 -0
  24. data/spec/fixtures/{markdown-gpl → gpl-2.0_markdown_headings}/LICENSE.md +0 -0
  25. data/spec/fixtures/gpl-3.0_markdown/LICENSE.md +595 -0
  26. data/spec/fixtures/lgpl-2.1_markdown/LICENSE.md +494 -0
  27. data/spec/fixtures/lgpl-3.0_markdown/LICENSE.md +163 -0
  28. data/spec/fixtures/license-hashes.json +10 -6
  29. data/spec/fixtures/mit_markdown/LICENSE.md +26 -0
  30. data/spec/fixtures/mpl-2.0_markdown/LICENSE.md +357 -0
  31. data/spec/fixtures/unlicense_markdown/LICENSE.md +27 -0
  32. data/spec/integration_spec.rb +11 -2
  33. data/spec/licensee/commands/detect_spec.rb +18 -2
  34. data/spec/licensee/content_helper_spec.rb +16 -0
  35. data/spec/licensee/license_meta_spec.rb +3 -3
  36. data/spec/licensee/license_spec.rb +7 -2
  37. data/spec/licensee/matchers/copyright_matcher_spec.rb +12 -3
  38. data/spec/licensee/matchers/dice_matcher_spec.rb +2 -2
  39. data/spec/licensee/matchers/reference_matcher_spec.rb +17 -0
  40. data/spec/licensee_spec.rb +1 -1
  41. data/vendor/choosealicense.com/_licenses/agpl-3.0.txt +3 -0
  42. data/vendor/choosealicense.com/_licenses/apache-2.0.txt +1 -1
  43. data/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +0 -1
  44. data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +1 -1
  45. data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +1 -1
  46. data/vendor/choosealicense.com/_licenses/cecill-2.1.txt +1 -0
  47. data/vendor/choosealicense.com/_licenses/cern-ohl-p-2.0.txt +216 -0
  48. data/vendor/choosealicense.com/_licenses/cern-ohl-s-2.0.txt +299 -0
  49. data/vendor/choosealicense.com/_licenses/cern-ohl-w-2.0.txt +321 -0
  50. data/vendor/choosealicense.com/_licenses/eupl-1.1.txt +1 -1
  51. data/vendor/choosealicense.com/_licenses/gfdl-1.3.txt +483 -0
  52. data/vendor/choosealicense.com/_licenses/mit.txt +1 -1
  53. data/vendor/choosealicense.com/_licenses/mulanpsl-2.0.txt +55 -56
  54. data/vendor/choosealicense.com/_licenses/unlicense.txt +1 -1
  55. data/vendor/license-list-XML/src/Artistic-2.0.xml +5 -3
  56. data/vendor/license-list-XML/src/BSD-3-Clause-Clear.xml +3 -1
  57. data/vendor/license-list-XML/src/BSD-3-Clause.xml +3 -1
  58. data/vendor/license-list-XML/src/BSD-4-Clause.xml +3 -3
  59. data/vendor/license-list-XML/src/CERN-OHL-P-2.0.xml +90 -0
  60. data/vendor/license-list-XML/src/CERN-OHL-S-2.0.xml +109 -0
  61. data/vendor/license-list-XML/src/CERN-OHL-W-2.0.xml +116 -0
  62. data/vendor/license-list-XML/src/GFDL-1.3.xml +594 -0
  63. data/vendor/license-list-XML/src/LGPL-3.0.xml +828 -1
  64. data/vendor/license-list-XML/src/MPL-2.0.xml +66 -29
  65. metadata +48 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 334874469d14f16839113e4311ba232c18a8bc8d0ee0c618034ec30e16497f47
4
- data.tar.gz: aaca8fc841545017ee7dc58e02a8ce41845d3253a281153b599f187218c6fc6a
3
+ metadata.gz: a971ca02733f55d37c599851a056742f8c40d758744c252c778c245082db6b3c
4
+ data.tar.gz: 5cd7c9da75de50b045a68510cb9ab9442029f4a5ce3ae7011438686161de1c03
5
5
  SHA512:
6
- metadata.gz: 7cd4ba6ef792da1ca97536e14b78d92c2fddf01dd14405fb859ad74db0f30018af62ea67af39a754f4a568f83f14a932d501772d83f1b5d19d22833fd8937e20
7
- data.tar.gz: 9fa7c61dde8ce35d2003c1119206047c3a35179e17484d0d5528e145f99bab29882c3da004a22214c777f758ade7607289a0d73a696135cc3a9c49467ed24238
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
 
@@ -216,7 +224,7 @@ module Licensee
216
224
  end
217
225
 
218
226
  def ==(other)
219
- !other.nil? && key == other.key
227
+ other.is_a?(self.class) && key == other.key
220
228
  end
221
229
 
222
230
  def pseudo_license?
@@ -6,7 +6,9 @@ module Licensee
6
6
  attr_reader :file
7
7
 
8
8
  COPYRIGHT_SYMBOLS = Regexp.union([/copyright/i, /\(c\)/i, "\u00A9", "\xC2\xA9"])
9
- REGEX = /#{ContentHelper::START_REGEX}([_*\-\s]*#{COPYRIGHT_SYMBOLS}.*$)+$/i.freeze
9
+ MAIN_LINE_REGEX = /[_*\-\s]*#{COPYRIGHT_SYMBOLS}.*$/i.freeze
10
+ OPTIONAL_LINE_REGEX = /[_*\-\s]*with Reserved Font Name.*$/i.freeze
11
+ REGEX = /#{ContentHelper::START_REGEX}(#{MAIN_LINE_REGEX}#{OPTIONAL_LINE_REGEX}*)+$/i.freeze
10
12
  def match
11
13
  # NOTE: must use content, and not content_normalized here
12
14
  Licensee::License.find('no-license') if /#{REGEX}+\z/io.match?(file.content.strip)
@@ -19,6 +19,7 @@ module Licensee
19
19
  .sub('_', '.')
20
20
  .sub('Mozilla', 'MPL')
21
21
  .sub(/^GPL-(\d)$/, 'GPL-\1.0')
22
+ .sub(/^AGPL-(\d)$/, 'AGPL-\1.0')
22
23
  end
23
24
  end
24
25
  end
@@ -60,7 +60,7 @@ module Licensee
60
60
  end
61
61
 
62
62
  def access_token
63
- ENV['OCTOKIT_ACCESS_TOKEN']
63
+ ENV.fetch('OCTOKIT_ACCESS_TOKEN', nil)
64
64
  end
65
65
  end
66
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Licensee
4
- VERSION = '9.15.2'
4
+ VERSION = '9.16.0'
5
5
  end
data/licensee.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |gem|
22
22
  gem.executables << 'licensee'
23
23
 
24
24
  gem.add_dependency('dotenv', '~> 2.0')
25
- gem.add_dependency('octokit', '~> 4.20')
26
- gem.add_dependency('reverse_markdown', '~> 1.0')
25
+ gem.add_dependency('octokit', '>= 4.20', '< 7.0')
26
+ gem.add_dependency('reverse_markdown', '>= 1', '< 3')
27
27
  gem.add_dependency('rugged', '>= 0.24', '<2.0')
28
28
  gem.add_dependency('thor', '>= 0.19', '< 2.0')
29
29
 
@@ -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