license-compatibility 1.1.0 → 1.2.0

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: 176806f73eddde23b44c22206d351f6456084f46
4
- data.tar.gz: 434dbd7c8a7b590bb07506e534356fcfed2094e4
3
+ metadata.gz: 6a72a9f4462d0ab36d0168c249bc84a80563de70
4
+ data.tar.gz: a03fb2460339debf54acc51bd2d081a40a687826
5
5
  SHA512:
6
- metadata.gz: 764d228bf994c2bae3bb6e87dc078f18385d855d36764ddcd18dde61b829ebb31e615f477535f5669bc050e2de63485533f1f9b5bf0ff9dc686cb2f3cc6ac5c1
7
- data.tar.gz: d6f4c8155cf00d19b6f031e3c207e5b6c2082fd7217b4e58c4cf9200b0d1c5210773911609e6ed694b48f90179b8a5cc385a91fda20d23c6f5699e1d98bcb739
6
+ metadata.gz: 2cc8477bfdb39d3e2317c906753e55fc67bc252772f480af498bb6def4d86e089aca35d2ae8644a0e8751458af7cc10fd9a461eba302e2003434a8eba046875b
7
+ data.tar.gz: 6c1fed55f983e1cec6bc363b615d673c8155957ad6d3ec29fcaefb9cc4c18c0eea16b6bb1d585cefcebcd0ad1227d64811b78e0a5fb2665c66c09ad379816267
data/README.md CHANGED
@@ -34,7 +34,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
34
34
 
35
35
  ## Contributing
36
36
 
37
- Bug reports and pull requests are welcome on GitHub at https://github.com/librariesio/license-compatibility. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/librariesio/license-compatibility. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
38
38
 
39
39
 
40
40
  ## License
@@ -1,17 +1,8 @@
1
+ require 'json'
1
2
  require "license/compatibility/version"
2
3
 
3
4
  module License
4
5
  module Compatibility
5
- PUBLIC_DOMAIN = ['PDDL-1.0', 'SAX-PD', 'Unlicense', 'CC0-1.0']
6
- PERMISSIVE = ['MIT', 'BSD-3-Clause', 'WTFPL', 'BSD-2-Clause', 'ISC',
7
- 'Apache-2.0', 'AFL-1.1', 'AFL-1.2', 'AFL-2.0', 'AFL-2.1', 'AFL-3.0',
8
- 'Artistic-2.0', 'Artistic-2.0', 'EPL-1.0', 'MPL-2.0', 'BSD-3-Clause-Clear',
9
- 'DSDP', 'ECL-2.0', 'BSD-3-Clause-Attribution']
10
- WEAK_COPYLEFT = ['LGPL-3.0', 'LGPL-2.0', 'LGPL-2.0+', 'LGPL-2.1', 'LGPL-2.1+',
11
- 'LGPL-3.0', 'LGPL-3.0+']
12
- COPYLEFT = ['GPL-3.0', 'GPL-2.0', 'GPL-2.0+', 'GPL-3.0+']
13
- STRONG_COPYLEFT = ['AGPL-1.0', 'AGPL-3.0']
14
-
15
6
  def self.forward_compatiblity(source_license, derivative_license)
16
7
  souce_type = license_type(source_license)
17
8
  derivative_type = license_type(derivative_license)
@@ -20,27 +11,31 @@ module License
20
11
  return true
21
12
  when :permissive, :weak_copyleft
22
13
  [:public_domain, :permissive, :weak_copyleft, :copyleft, :strong_copyleft].include? derivative_type
23
- when :copyleft
24
- [:copyleft, :strong_copyleft].include? derivative_type
25
14
  when :strong_copyleft
26
- [:strong_copyleft].include? derivative_type
15
+ [:strong_copyleft, :network_copyleft].include? derivative_type
16
+ when :network_copyleft
17
+ [:network_copyleft].include? derivative_type
27
18
  else
28
19
  raise 'Unknown license compatiblity'
29
20
  end
30
21
  end
31
22
 
23
+ def self.license_data
24
+ @@license_data ||= JSON.load(File.read(File.expand_path('../licenses.json', __FILE__)))
25
+ end
26
+
32
27
  def self.license_type(license)
33
- # TODO convert license into standard SPDX format
34
- if PUBLIC_DOMAIN.include?(license)
28
+ license = license.gsub('+', '')
29
+ if license_data['public_domain'].include?(license)
35
30
  :public_domain
36
- elsif PERMISSIVE.include?(license)
31
+ elsif license_data['permissive'].include?(license)
37
32
  :permissive
38
- elsif WEAK_COPYLEFT.include?(license)
33
+ elsif license_data['weak_copyleft'].include?(license)
39
34
  :weak_copyleft
40
- elsif COPYLEFT.include?(license)
41
- :copyleft
42
- elsif STRONG_COPYLEFT.include?(license)
35
+ elsif license_data['strong_copyleft'].include?(license)
43
36
  :strong_copyleft
37
+ elsif license_data['network_copyleft'].include?(license)
38
+ :network_copyleft
44
39
  else
45
40
  raise 'Unknown license type'
46
41
  end
@@ -1,5 +1,5 @@
1
1
  module License
2
2
  module Compatibility
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ {
2
+ "public_domain": ["PDDL-1.0", "SAX-PD", "Unlicense", "CC0-1.0"],
3
+ "permissive": ["MIT", "BSD-3-Clause", "WTFPL", "BSD-2-Clause", "ISC", "Apache-2.0", "AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0", "Artistic-2.0", "BSD-3-Clause-Clear", "DSDP", "ECL-2.0", "BSD-3-Clause-Attribution"],
4
+ "weak_copyleft": ["LGPL-3.0", "LGPL-2.0", "LGPL-2.1", "LGPL-3.0", "MPL-2.0", "EPL-1.0"],
5
+ "strong_copyleft": ["GPL-3.0", "GPL-2.0"],
6
+ "network_copyleft": ["AGPL-1.0", "AGPL-3.0"]
7
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license-compatibility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-28 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,7 @@ files:
71
71
  - bin/setup
72
72
  - lib/license/compatibility.rb
73
73
  - lib/license/compatibility/version.rb
74
+ - lib/license/licenses.json
74
75
  - license-compatibility.gemspec
75
76
  homepage: https://github.com/librariesio/license-compatibility
76
77
  licenses: