spdx 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/spdx.rb +21 -1
- data/lib/spdx/version.rb +1 -1
- data/spdx.gemspec +2 -2
- data/spec/spdx_spec.rb +14 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35c016f37e6cbd9cf4065a28b68c6508c939d69a
|
4
|
+
data.tar.gz: 19f52bc82a38452d9fc815056155241bcedf632f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c55b595002ffeeb1b32c02f19b6cb3f1163694f23e5e0294a15e26e69bc86633ad2efa1888e8ae571f752011fb826d49a8de753383839b447ac666607aceaca3
|
7
|
+
data.tar.gz: a1a0083884dd5c5d2d118afdde82a0ee8d9a1199275f181c592bf913eaf84a081dcd4fe3b9bcdb1bf1b79df74fa1e82edd5733d434ed381d575cf549f2466503
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Spdx.find('Apache 2') # => <SpdxLicenses::License:0x007fa3a2b462c8 @id="Apache-2
|
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
31
|
-
1. Fork it ( https://github.com/
|
31
|
+
1. Fork it ( https://github.com/librariesio/spdx/fork )
|
32
32
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
33
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
34
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/spdx.rb
CHANGED
@@ -4,7 +4,7 @@ require "fuzzy_match"
|
|
4
4
|
|
5
5
|
module Spdx
|
6
6
|
def self.find(name)
|
7
|
-
SpdxLicenses[name] || closest(name)
|
7
|
+
SpdxLicenses[name] || find_by_special_case(name) || closest(name)
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.closest(name)
|
@@ -34,6 +34,26 @@ module Spdx
|
|
34
34
|
SpdxLicenses[match[0]] if match
|
35
35
|
end
|
36
36
|
|
37
|
+
def self.find_by_special_case(name)
|
38
|
+
SpdxLicenses[special_cases[name.downcase]]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.special_cases
|
42
|
+
{
|
43
|
+
'perl_5' => 'Artistic-1.0-Perl',
|
44
|
+
'bsd3' => 'BSD-3-Clause',
|
45
|
+
'bsd' => 'BSD-3-Clause',
|
46
|
+
'new bsd license' => 'BSD-3-Clause',
|
47
|
+
'gplv3' => 'GPL-3.0',
|
48
|
+
'gpl-2' => 'GPL-2.0',
|
49
|
+
'gpl' => 'GPL-2.0+',
|
50
|
+
"gnu lesser general public license" => 'LGPL-2.1+',
|
51
|
+
'lgplv2 or later' => 'LGPL-2.1+',
|
52
|
+
'gplv2 or later' => 'GPL-2.0+',
|
53
|
+
'public domain' => 'Unlicense'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
37
57
|
def self.names
|
38
58
|
SpdxLicenses.data.keys + SpdxLicenses.data.map{|k,v| v['name'] }
|
39
59
|
end
|
data/lib/spdx/version.rb
CHANGED
data/spdx.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Andrew Nesbitt"]
|
10
10
|
spec.email = ["andrewnez@gmail.com"]
|
11
11
|
spec.summary = %q{A SPDX license checker}
|
12
|
-
spec.homepage = ""
|
12
|
+
spec.homepage = "https://github.com/librariesio/spdx"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "fuzzy_match", "~> 2.1"
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.7"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
25
25
|
end
|
data/spec/spdx_spec.rb
CHANGED
@@ -30,5 +30,19 @@ describe Spdx do
|
|
30
30
|
expect(Spdx.find('The MIT License').name).to eq("MIT License")
|
31
31
|
expect(Spdx.find('UNLICENSE').name).to eq("The Unlicense")
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should return know licenses for special cases" do
|
35
|
+
expect(Spdx.find('perl_5').name).to eq("Artistic License 1.0 (Perl)")
|
36
|
+
expect(Spdx.find('BSD3').name).to eq('BSD 3-clause "New" or "Revised" License')
|
37
|
+
expect(Spdx.find('BSD').name).to eq('BSD 3-clause "New" or "Revised" License')
|
38
|
+
expect(Spdx.find('GPLv3').name).to eq('GNU General Public License v3.0 only')
|
39
|
+
expect(Spdx.find('LGPLv2 or later').name).to eq('GNU Lesser General Public License v2.1 or later')
|
40
|
+
expect(Spdx.find('GPLv2 or later').name).to eq('GNU General Public License v2.0 or later')
|
41
|
+
expect(Spdx.find('Public Domain').name).to eq('The Unlicense')
|
42
|
+
expect(Spdx.find('GPL-2').name).to eq('GNU General Public License v2.0 only')
|
43
|
+
expect(Spdx.find('GPL').name).to eq('GNU General Public License v2.0 or later')
|
44
|
+
expect(Spdx.find('GNU LESSER GENERAL PUBLIC LICENSE').name).to eq('GNU Lesser General Public License v2.1 or later')
|
45
|
+
expect(Spdx.find('New BSD License').name).to eq('BSD 3-clause "New" or "Revised" License')
|
46
|
+
end
|
33
47
|
end
|
34
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spdx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spdx-licenses
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.1.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.1.0
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- andrewnez@gmail.com
|
@@ -98,7 +98,7 @@ files:
|
|
98
98
|
- spdx.gemspec
|
99
99
|
- spec/spdx_spec.rb
|
100
100
|
- spec/spec_helper.rb
|
101
|
-
homepage:
|
101
|
+
homepage: https://github.com/librariesio/spdx
|
102
102
|
licenses:
|
103
103
|
- MIT
|
104
104
|
metadata: {}
|