spdx 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa627273036131fa08d4f86f4417af5d83460bfe
4
- data.tar.gz: b97f0e1e07ed9d62f0030900c4b27459dc6fccad
3
+ metadata.gz: ab3e6557189a1de56e427e3fb850c5e621b1d090
4
+ data.tar.gz: c49c6f91cf60a21b90332ad232a062ddf8544aaa
5
5
  SHA512:
6
- metadata.gz: 9e9f56d2101d1a2977f710de701de0b7c272654e2bb0de608623e5fecea1dfd76d8541eb1b2d8b5fa404fda9f7ba0d09446ef7fe0a84dbb23a8b87aa5d0fc16e
7
- data.tar.gz: '099c7fc40ec3688369f2e9db8f9d4b3399b8696b191a659a2f8151f24d56af280a09934c19f1186d2821e40cd43023480eb3b0a1a1f002386be2163baa048661'
6
+ metadata.gz: a597db243044fc4922958419fb0969e3411df16a4d384d34f16a4c404be00ccc2184ab80cceb29fc0a2add60df0d7beb6e13d8def2aeee2a2952a74e8546ecdc
7
+ data.tar.gz: 86b3640405a433ae217476cec7bf27e9e161ea08724716675d732bc4c1e04ced1feb8349720efa7fa668a089170221b853d5803e272e78ccdb9b51c289adaa41
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Metrics/BlockLength:
5
+ Max: 125
6
+ Exclude:
7
+ - spec/**/*_spec.rb
8
+
9
+ # It's 2019, allow longer line lengths
10
+ Metrics/LineLength:
11
+ Max: 120
12
+
13
+ Metrics/AbcSize:
14
+ Enabled: false
15
+
16
+ Style/FrozenStringLiteralComment:
17
+ Enabled: False
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.2
4
3
  - 2.5.0
5
4
  cache: bundler
6
5
  sudo: false
data/Rakefile CHANGED
File without changes
data/lib/spdx.rb CHANGED
@@ -1,28 +1,31 @@
1
- require "spdx/version"
2
- require "spdx-licenses"
3
- require "fuzzy_match"
1
+ require 'spdx/version'
2
+ require 'spdx-licenses'
3
+ require 'fuzzy_match'
4
4
 
5
- module Spdx
5
+ # Fuzzy matcher for licenses to SPDX standard licenses
6
+ module Spdx # rubocop:disable Metrics/ModuleLength
6
7
  def self.find(name)
7
8
  name = name.strip
8
9
  return nil if commercial?(name)
10
+
9
11
  search(name)
10
12
  end
11
13
 
12
14
  def self.search(name)
13
15
  lookup(name) ||
14
- find_by_special_case(name) ||
15
- closest(name)
16
+ find_by_special_case(name) ||
17
+ closest(name)
16
18
  end
17
19
 
18
20
  def self.commercial?(name)
19
- name.downcase == 'commercial'
21
+ name.casecmp('commercial').zero?
20
22
  end
21
23
 
22
24
  def self.lookup(name)
23
25
  return false if name.nil?
24
26
  return SpdxLicenses[name] if SpdxLicenses.exist?(name)
25
- lowercase = SpdxLicenses.data.keys.find{|k| k.downcase == name.downcase }
27
+
28
+ lowercase = SpdxLicenses.data.keys.sort.find { |k| k.casecmp(name).zero? }
26
29
  SpdxLicenses[lowercase] if lowercase
27
30
  end
28
31
 
@@ -31,13 +34,14 @@ module Spdx
31
34
  name.gsub!(/(\d)/, ' \1 ')
32
35
  best_match = fuzzy_match(name)
33
36
  return nil unless best_match
37
+
34
38
  lookup(best_match) || find_by_name(best_match)
35
39
  end
36
40
 
37
41
  def self.matches(name, max_distance = 40)
38
42
  names.map { |key| [key, Text::Levenshtein.distance(name, key)] }
39
- .select { |arr| arr[1] <= max_distance }
40
- .sort_by { |arr| arr[1] }
43
+ .select { |arr| arr[1] <= max_distance }
44
+ .sort_by { |arr| arr[1] }
41
45
  end
42
46
 
43
47
  def self.fuzzy_match(name)
@@ -45,27 +49,29 @@ module Spdx
45
49
  end
46
50
 
47
51
  def self.stop_words
48
- %w(version software the or right all)
52
+ %w[version software the or right all]
49
53
  end
50
54
 
51
55
  def self.find_by_name(name)
52
- match = SpdxLicenses.data.find{|k,v| v['name'] == name }
56
+ match = SpdxLicenses.data.find { |_k, v| v['name'] == name }
53
57
  lookup(match[0]) if match
54
58
  end
55
59
 
56
60
  def self.find_by_special_case(name)
57
61
  gpl = gpl_match(name)
58
62
  return gpl if gpl
63
+
59
64
  lookup(special_cases[name.downcase.strip])
60
65
  end
61
66
 
62
67
  def self.gpl_match(name)
63
68
  match = name.match(/^(l|a)?gpl-?\s?_?v?(1|2|3)\.?(\d)?(\+)?$/i)
64
69
  return unless match
70
+
65
71
  lookup "#{match[1]}GPL-#{match[2]}.#{match[3] || 0}#{match[4]}"
66
72
  end
67
73
 
68
- def self.special_cases
74
+ def self.special_cases # rubocop:disable Metrics/MethodLength
69
75
  {
70
76
  'perl_5' => 'Artistic-1.0-Perl',
71
77
  'bsd3' => 'BSD-3-Clause',
@@ -86,7 +92,7 @@ module Spdx
86
92
  'mpl1.0' => 'mpl-1.0',
87
93
  'mpl1.1' => 'mpl-1.1',
88
94
  'mpl2' => 'mpl-2.0',
89
- "gnu lesser general public license" => 'LGPL-2.1+',
95
+ 'gnu lesser general public license' => 'LGPL-2.1+',
90
96
  'lgplv2 or later' => 'LGPL-2.1+',
91
97
  'gpl2 w/ cpe' => 'GPL-2.0-with-classpath-exception',
92
98
  'new bsd license (gpl-compatible)' => 'BSD-3-Clause',
@@ -132,14 +138,38 @@ module Spdx
132
138
  '3-clause bsdl' => 'BSD-3-clause',
133
139
  '2-clause bsd' => 'BSD-2-clause',
134
140
  '3-clause bsd' => 'BSD-3-clause',
135
- "bsd 3-clause" => 'BSD-3-clause',
136
- "bsd 2-clause" => 'BSD-2-clause',
137
- "two-clause bsd-style license" => 'BSD-2-clause',
138
- "bsd style" => 'BSD-3-clause'
141
+ 'bsd 3-clause' => 'BSD-3-clause',
142
+ 'bsd 2-clause' => 'BSD-2-clause',
143
+ 'two-clause bsd-style license' => 'BSD-2-clause',
144
+ 'bsd style' => 'BSD-3-clause',
145
+ 'cc0 1.0 universal (cc0 1.0) public domain dedication' => 'CC0-1.0',
146
+ 'common development and distribution license 1.0 (cddl-1.0)' => 'CDDL-1.0',
147
+ 'european union public licence 1.0 (eupl 1.0)' => 'EUPL-1.0',
148
+ 'european union public licence 1.1 (eupl 1.1)' => 'EUPL-1.1',
149
+ 'european union public licence 1.2 (eupl 1.2)' => 'EUPL-1.2',
150
+ 'vovida software license 1.0' => 'VSL-1.0',
151
+ 'w3c license' => 'W3C',
152
+ 'zlib/libpng license' => 'zlib-acknowledgement',
153
+ 'gnu general public license (gpl)' => 'GPL-2.0+',
154
+ 'gnu general public license v2 (gplv2)' => 'GPL-2.0',
155
+ 'gnu general public license v2 or later (gplv2+)' => 'GPL-2.0+',
156
+ 'gnu general public license v3 (gplv3)' => 'GPL-3.0',
157
+ 'gnu general public license v3 or later (gplv3+)' => 'GPL-3.0+',
158
+ 'gnu lesser general public license v2 (lgplv2)' => 'LGPL-2.0',
159
+ 'gnu lesser general public license v2 or later (lgplv2+)' => 'LGPL-2.0+',
160
+ 'gnu lesser general public license v3 (lgplv3)' => 'LGPL-3.0',
161
+ 'gnu lesser general public license v3 or later (lgplv3+)' => 'LGPL-3.0+',
162
+ 'gnu library or lesser general public license (lgpl)' => 'LGPL-2.0+',
163
+ 'netscape public License (npl)' => 'NPL-1.1',
164
+ 'apache software license' => 'Apache-2.0',
165
+ 'academic free license (afl)' => 'AFL-3.0',
166
+ 'gnu free documentation license (fdl)' => 'GFDL-1.3',
167
+ 'sun industry standards source license (sissl)' => 'SISSL-1.2',
168
+ 'zope public license' => 'ZPL-2.1'
139
169
  }
140
170
  end
141
171
 
142
172
  def self.names
143
- SpdxLicenses.data.keys + SpdxLicenses.data.map{|k,v| v['name'] }
173
+ (SpdxLicenses.data.keys + SpdxLicenses.data.map { |_k, v| v['name'] }).sort
144
174
  end
145
175
  end
data/lib/spdx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spdx
2
- VERSION = "1.4.1"
2
+ VERSION = '1.4.2'.freeze
3
3
  end
data/spdx.gemspec CHANGED
@@ -1,25 +1,25 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'spdx/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "spdx"
6
+ spec.name = 'spdx'
8
7
  spec.version = Spdx::VERSION
9
- spec.authors = ["Andrew Nesbitt"]
10
- spec.email = ["andrewnez@gmail.com"]
11
- spec.summary = %q{A SPDX license normalizer}
12
- spec.homepage = "https://github.com/librariesio/spdx"
13
- spec.license = "MIT"
8
+ spec.authors = ['Andrew Nesbitt']
9
+ spec.email = ['andrewnez@gmail.com']
10
+ spec.summary = 'A SPDX license normalizer'
11
+ spec.homepage = 'https://github.com/librariesio/spdx'
12
+ spec.license = 'MIT'
14
13
 
15
14
  spec.files = `git ls-files -z`.split("\x0")
16
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
17
+ spec.require_paths = ['lib']
19
18
 
20
- spec.add_dependency "spdx-licenses", "~> 1.2"
21
- spec.add_dependency "fuzzy_match", "~> 2.1"
22
- spec.add_development_dependency "bundler", "~> 1.16"
23
- spec.add_development_dependency "rake", "~> 12"
24
- spec.add_development_dependency "rspec", "~> 3.7"
19
+ spec.add_dependency 'fuzzy_match', '~> 2.1'
20
+ spec.add_dependency 'spdx-licenses', '~> 1.2'
21
+ spec.add_development_dependency 'bundler', '~> 1.16'
22
+ spec.add_development_dependency 'rake', '~> 12'
23
+ spec.add_development_dependency 'rspec', '~> 3.7'
24
+ spec.add_development_dependency 'rubocop'
25
25
  end
data/spec/spdx_spec.rb CHANGED
@@ -2,45 +2,117 @@ require 'spec_helper'
2
2
 
3
3
  describe Spdx do
4
4
  describe 'find' do
5
- it "should return know license from short code" do
6
- expect(Spdx.find('Apache-2.0').name).to eq("Apache License 2.0")
5
+ it 'should return know license from short code' do
6
+ expect(Spdx.find('Apache-2.0').name).to eq('Apache License 2.0')
7
7
  end
8
8
 
9
- it "should work with case-insentive short codes" do
10
- expect(Spdx.find('apache-2.0').name).to eq("Apache License 2.0")
11
- expect(Spdx.find('agpl-3.0').name).to eq("GNU Affero General Public License v3.0")
9
+ it 'should work with case-insentive short codes' do
10
+ expect(Spdx.find('apache-2.0').name).to eq('Apache License 2.0')
11
+ expect(Spdx.find('agpl-3.0').name).to eq('GNU Affero General Public License v3.0')
12
12
  end
13
13
 
14
- it "should return know license from full name" do
15
- expect(Spdx.find('Apache License 2.0').name).to eq("Apache License 2.0")
14
+ it 'should return know license from full name' do
15
+ expect(Spdx.find('Apache License 2.0').name).to eq('Apache License 2.0')
16
16
  end
17
17
 
18
- it "should return nil for commercial" do
18
+ it 'should return nil for commercial' do
19
19
  expect(Spdx.find('Commercial')).to be_nil
20
20
  end
21
21
 
22
- it "should return nil for garbage" do
22
+ it 'should return nil for garbage' do
23
23
  expect(Spdx.find('foo bar baz')).to be_nil
24
24
  expect(Spdx.find('Copyright Zendesk. All Rights Reserved.')).to be_nil
25
25
  expect(Spdx.find('https://github.com/AuthorizeNet/sdk-ruby/blob/master/license.txt')).to be_nil
26
26
  end
27
27
 
28
- it "should return know license from an alias" do
29
- expect(Spdx.find('The Apache Software License, Version 2.0').name).to eq("Apache License 2.0")
30
- expect(Spdx.find('Apache 2.0').name).to eq("Apache License 2.0")
31
- expect(Spdx.find('Apache2').name).to eq("Apache License 2.0")
32
- expect(Spdx.find('Apache License, Version 2.0').name).to eq("Apache License 2.0")
33
- expect(Spdx.find('Educational Community License, Version 2.0').name).to eq("Educational Community License v2.0")
34
- expect(Spdx.find('CDDL + GPLv2 with classpath exception').name).to eq("GNU General Public License v2.0 w/Classpath exception")
35
- expect(Spdx.find('The MIT License').name).to eq("MIT License")
36
- expect(Spdx.find('UNLICENSE').name).to eq("The Unlicense")
28
+ it 'should return know license from an alias' do
29
+ expect(Spdx.find('The Apache Software License, Version 2.0').name).to eq('Apache License 2.0')
30
+ expect(Spdx.find('Apache 2.0').name).to eq('Apache License 2.0')
31
+ expect(Spdx.find('Apache2').name).to eq('Apache License 2.0')
32
+ expect(Spdx.find('Apache License, Version 2.0').name).to eq('Apache License 2.0')
33
+ expect(Spdx.find('Educational Community License, Version 2.0').name).to eq('Educational Community License v2.0')
34
+ expect(Spdx.find('CDDL + GPLv2 with classpath exception').name).to \
35
+ eq('GNU General Public License v2.0 w/Classpath exception')
36
+ expect(Spdx.find('The MIT License').name).to eq('MIT License')
37
+ expect(Spdx.find('UNLICENSE').name).to eq('The Unlicense')
37
38
  end
38
39
 
39
- it "should strip whitespace from strings before lookups" do
40
- expect(Spdx.find(" BSD-3-Clause").id).to eq("BSD-3-Clause")
40
+ it 'should strip whitespace from strings before lookups' do
41
+ expect(Spdx.find(' BSD-3-Clause').id).to eq('BSD-3-Clause')
41
42
  end
42
43
 
43
- it "should return know licenses for special cases" do
44
+ it 'should handle pypi classifiers properly' do
45
+ pypi_mappings = [
46
+ ['Aladdin Free Public License (AFPL)', 'Aladdin'],
47
+ ['CC0 1.0 Universal (CC0 1.0) Public Domain Dedication', 'CC0-1.0'],
48
+ ['CeCILL-B Free Software License Agreement (CECILL-B)', 'CECILL-B'],
49
+ ['CeCILL-C Free Software License Agreement (CECILL-C)', 'CECILL-C'],
50
+ ['Eiffel Forum License (EFL)', 'EFL-2.0'],
51
+ ['Netscape Public License (NPL)', 'NPL-1.1'],
52
+ ['Nokia Open Source License (NOKOS)', 'Nokia'],
53
+ ['Academic Free License (AFL)', 'AFL-3.0'],
54
+ ['Apache Software License', 'Apache-2.0'],
55
+ ['Apple Public Source License', 'APSL-2.0'],
56
+ ['Artistic License', 'Artistic-2.0'],
57
+ ['Attribution Assurance License', 'AAL'],
58
+ ['Boost Software License 1.0 (BSL-1.0)', 'BSL-1.0'],
59
+ ['BSD License', 'BSD-3-Clause'],
60
+ ['Common Development and Distribution License 1.0 (CDDL-1.0)', 'CDDL-1.0'],
61
+ ['Common Public License', 'CPL-1.0'],
62
+ ['Eclipse Public License 1.0 (EPL-1.0)', 'EPL-1.0'],
63
+ ['Eclipse Public License 2.0 (EPL-2.0)', 'EPL-2.0'],
64
+ ['Eiffel Forum License', 'EFL-2.0'],
65
+ ['European Union Public Licence 1.0 (EUPL 1.0)', 'EUPL-1.0'],
66
+ ['European Union Public Licence 1.1 (EUPL 1.1)', 'EUPL-1.1'],
67
+ ['European Union Public Licence 1.2 (EUPL 1.2)', 'EUPL-1.2'],
68
+ ['GNU Affero General Public License v3', 'AGPL-3.0'],
69
+ ['GNU Affero General Public License v3 or later (AGPLv3+)', 'AGPL-3.0-or-later'],
70
+ ['GNU Free Documentation License (FDL)', 'GFDL-1.3'],
71
+ ['GNU General Public License (GPL)', 'GPL-2.0+'],
72
+ ['GNU General Public License v2 (GPLv2)', 'GPL-2.0'],
73
+ ['GNU General Public License v2 or later (GPLv2+)', 'GPL-2.0+'],
74
+ ['GNU General Public License v3 (GPLv3)', 'GPL-3.0'],
75
+ ['GNU General Public License v3 or later (GPLv3+)', 'GPL-3.0+'],
76
+ ['GNU Lesser General Public License v2 (LGPLv2)', 'LGPL-2.0'],
77
+ ['GNU Lesser General Public License v2 or later (LGPLv2+)', 'LGPL-2.0+'],
78
+ ['GNU Lesser General Public License v3 (LGPLv3)', 'LGPL-3.0'],
79
+ ['GNU Lesser General Public License v3 or later (LGPLv3+)', 'LGPL-3.0+'],
80
+ ['GNU Library or Lesser General Public License (LGPL)', 'LGPL-2.0+'],
81
+ ['IBM Public License', 'IPL-1.0'],
82
+ ['Intel Open Source License', 'Intel'],
83
+ ['ISC License (ISCL)', 'ISC'],
84
+ ['MirOS License (MirOS)', 'MirOS'],
85
+ ['MIT License', 'MIT'],
86
+ ['Motosoto License', 'Motosoto'],
87
+ ['Mozilla Public License 1.0 (MPL)', 'MPL-1.0'],
88
+ ['Mozilla Public License 1.1 (MPL 1.1)', 'MPL-1.1'],
89
+ ['Mozilla Public License 2.0 (MPL 2.0)', 'MPL-2.0'],
90
+ ['Nethack General Public License', 'NGPL'],
91
+ ['Nokia Open Source License', 'Nokia'],
92
+ ['Open Group Test Suite License', 'OGTSL'],
93
+ ['PostgreSQL License', 'PostgreSQL'],
94
+ ['Python License (CNRI Python License)', 'CNRI-Python'],
95
+ ['Python Software Foundation License', 'Python-2.0'],
96
+ ['Qt Public License (QPL)', 'QPL-1.0'],
97
+ ['Ricoh Source Code Public License', 'RSCPL'],
98
+ ['SIL Open Font License 1.1 (OFL-1.1)', 'OFL-1.1'],
99
+ ['Sleepycat License', 'Sleepycat'],
100
+ ['Sun Industry Standards Source License (SISSL)', 'SISSL-1.2'],
101
+ ['Sun Public License', 'SPL-1.0'],
102
+ ['Universal Permissive License (UPL)', 'UPL-1.0'],
103
+ ['University of Illinois/NCSA Open Source License', 'NCSA'],
104
+ ['Vovida Software License 1.0', 'VSL-1.0'],
105
+ ['W3C License', 'W3C'],
106
+ ['X.Net License', 'Xnet'],
107
+ ['zlib/libpng License', 'zlib-acknowledgement'],
108
+ ['Zope Public License', 'ZPL-2.1']
109
+ ]
110
+ pypi_mappings.each do |license, mapped|
111
+ expect(Spdx.find(license).id).to eq(mapped)
112
+ end
113
+ end
114
+
115
+ it 'should return know licenses for special cases' do
44
116
  expect(Spdx.find('MPL1').name).to eq('Mozilla Public License 1.0')
45
117
  expect(Spdx.find('MPL1.0').name).to eq('Mozilla Public License 1.0')
46
118
  expect(Spdx.find('MPL1.1').name).to eq('Mozilla Public License 1.1')
@@ -51,21 +123,24 @@ describe Spdx do
51
123
  expect(Spdx.find('GPL3').name).to eq('GNU General Public License v3.0 only')
52
124
  expect(Spdx.find('GPL 3.0').name).to eq('GNU General Public License v3.0 only')
53
125
  expect(Spdx.find('GPL-3').name).to eq('GNU General Public License v3.0 only')
54
- expect(Spdx.find('GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]').name).to eq('GNU General Public License v2.0 or later')
55
- expect(Spdx.find('GPL-2 | GPL-3 [expanded from: GPL]').name).to eq('GNU General Public License v2.0 or later')
126
+ expect(Spdx.find('GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]').name).to \
127
+ eq('GNU General Public License v2.0 or later')
128
+ expect(Spdx.find('GPL-2 | GPL-3 [expanded from: GPL]').name).to \
129
+ eq('GNU General Public License v2.0 or later')
56
130
  expect(Spdx.find('GPL (≥ 3)').name).to eq('GNU General Public License v3.0 or later')
57
131
  expect(Spdx.find('gpl30').name).to eq('GNU General Public License v3.0 only')
58
- expect(Spdx.find("GPL v2+").name).to eq('GNU General Public License v2.0 or later')
59
- expect(Spdx.find("GPL 2").name).to eq('GNU General Public License v2.0 only')
60
- expect(Spdx.find("GPL v2").name).to eq('GNU General Public License v2.0 only')
61
- expect(Spdx.find("GPL2").name).to eq('GNU General Public License v2.0 only')
62
- expect(Spdx.find("GPL-2 | GPL-3").name).to eq('GNU General Public License v2.0 or later')
63
- expect(Spdx.find("GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)]").name).to eq('GNU General Public License v2.0 or later')
64
- expect(Spdx.find("GPL2 w/ CPE").name).to eq('GNU General Public License v2.0 w/Classpath exception')
65
- expect(Spdx.find("GPL 2.0").name).to eq('GNU General Public License v2.0 only')
66
- expect(Spdx.find("New BSD License (GPL-compatible)").name).to eq('BSD 3-Clause "New" or "Revised" License')
67
- expect(Spdx.find("The GPL V3").name).to eq('GNU General Public License v3.0 only')
68
- expect(Spdx.find('perl_5').name).to eq("Artistic License 1.0 (Perl)")
132
+ expect(Spdx.find('GPL v2+').name).to eq('GNU General Public License v2.0 or later')
133
+ expect(Spdx.find('GPL 2').name).to eq('GNU General Public License v2.0 only')
134
+ expect(Spdx.find('GPL v2').name).to eq('GNU General Public License v2.0 only')
135
+ expect(Spdx.find('GPL2').name).to eq('GNU General Public License v2.0 only')
136
+ expect(Spdx.find('GPL-2 | GPL-3').name).to eq('GNU General Public License v2.0 or later')
137
+ expect(Spdx.find('GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)]').name).to \
138
+ eq('GNU General Public License v2.0 or later')
139
+ expect(Spdx.find('GPL2 w/ CPE').name).to eq('GNU General Public License v2.0 w/Classpath exception')
140
+ expect(Spdx.find('GPL 2.0').name).to eq('GNU General Public License v2.0 only')
141
+ expect(Spdx.find('New BSD License (GPL-compatible)').name).to eq('BSD 3-Clause "New" or "Revised" License')
142
+ expect(Spdx.find('The GPL V3').name).to eq('GNU General Public License v3.0 only')
143
+ expect(Spdx.find('perl_5').name).to eq('Artistic License 1.0 (Perl)')
69
144
  expect(Spdx.find('BSD3').name).to eq('BSD 3-Clause "New" or "Revised" License')
70
145
  expect(Spdx.find('BSD').name).to eq('BSD 3-Clause "New" or "Revised" License')
71
146
  expect(Spdx.find('GPLv3').name).to eq('GNU General Public License v3.0 only')
@@ -74,14 +149,16 @@ describe Spdx do
74
149
  expect(Spdx.find('Public Domain').name).to eq('The Unlicense')
75
150
  expect(Spdx.find('GPL-2').name).to eq('GNU General Public License v2.0 only')
76
151
  expect(Spdx.find('GPL').name).to eq('GNU General Public License v2.0 or later')
77
- expect(Spdx.find('GNU LESSER GENERAL PUBLIC LICENSE').name).to eq('GNU Library General Public License v2.1 or later')
152
+ expect(Spdx.find('GNU LESSER GENERAL PUBLIC LICENSE').name).to \
153
+ eq('GNU Library General Public License v2.1 or later')
78
154
  expect(Spdx.find('New BSD License').name).to eq('BSD 3-Clause "New" or "Revised" License')
79
155
  expect(Spdx.find('(MIT OR X11) ').name).to eq('MIT License')
80
156
  expect(Spdx.find('mit-license').name).to eq('MIT License')
81
157
  expect(Spdx.find('lgpl-3').name).to eq('GNU Lesser General Public License v3.0 only')
82
158
  expect(Spdx.find('agpl-3').name).to eq('GNU Affero General Public License v3.0')
83
159
  expect(Spdx.find('cc by-sa 4.0').name).to eq('Creative Commons Attribution Share Alike 4.0 International')
84
- expect(Spdx.find('cc by-nc-sa 3.0').name).to eq('Creative Commons Attribution Non Commercial Share Alike 3.0 Unported')
160
+ expect(Spdx.find('cc by-nc-sa 3.0').name).to \
161
+ eq('Creative Commons Attribution Non Commercial Share Alike 3.0 Unported')
85
162
  expect(Spdx.find('cc by-sa 3.0').name).to eq('Creative Commons Attribution Share Alike 3.0 Unported')
86
163
  expect(Spdx.find('gpl_1').name).to eq('GNU General Public License v1.0 only')
87
164
  expect(Spdx.find('gpl_2').name).to eq('GNU General Public License v2.0 only')
@@ -93,14 +170,14 @@ describe Spdx do
93
170
  expect(Spdx.find('lgpl_2_1').name).to eq('GNU Lesser General Public License v2.1 only')
94
171
  expect(Spdx.find('lgpl_v2_1').name).to eq('GNU Lesser General Public License v2.1 only')
95
172
 
96
- expect(Spdx.find("BSD 3-Clause").name).to eq("BSD 3-Clause \"New\" or \"Revised\" License")
97
- expect(Spdx.find("BSD 3-Clause").name).to eq("BSD 3-Clause \"New\" or \"Revised\" License")
98
- expect(Spdx.find("BSD 2-Clause").name).to eq("BSD 2-Clause \"Simplified\" License")
99
- expect(Spdx.find("BSD 2-clause").name).to eq("BSD 2-Clause \"Simplified\" License")
100
- expect(Spdx.find("BSD Style").name).to eq("BSD 3-Clause \"New\" or \"Revised\" License")
173
+ expect(Spdx.find('BSD 3-Clause').name).to eq('BSD 3-Clause "New" or "Revised" License')
174
+ expect(Spdx.find('BSD 3-Clause').name).to eq('BSD 3-Clause "New" or "Revised" License')
175
+ expect(Spdx.find('BSD 2-Clause').name).to eq('BSD 2-Clause "Simplified" License')
176
+ expect(Spdx.find('BSD 2-clause').name).to eq('BSD 2-Clause "Simplified" License')
177
+ expect(Spdx.find('BSD Style').name).to eq('BSD 3-Clause "New" or "Revised" License')
101
178
 
102
- expect(Spdx.find("GNU LGPL v3+").name).to eq("GNU Lesser General Public License v3.0 only")
103
- expect(Spdx.find("ZPL 2.1").name).to eq("Zope Public License 2.1")
179
+ expect(Spdx.find('GNU LGPL v3+').name).to eq('GNU Lesser General Public License v3.0 only')
180
+ expect(Spdx.find('ZPL 2.1').name).to eq('Zope Public License 2.1')
104
181
  end
105
182
  end
106
183
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spdx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-12 00:00:00.000000000 Z
11
+ date: 2019-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: spdx-licenses
14
+ name: fuzzy_match
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: fuzzy_match
28
+ name: spdx-licenses
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.1'
33
+ version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.1'
40
+ version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description:
84
98
  email:
85
99
  - andrewnez@gmail.com
@@ -93,6 +107,7 @@ files:
93
107
  - ".github/SUPPORT.md"
94
108
  - ".gitignore"
95
109
  - ".rspec"
110
+ - ".rubocop.yml"
96
111
  - ".travis.yml"
97
112
  - CODE_OF_CONDUCT.md
98
113
  - Gemfile