mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
validate SPDX compliance
This commit is contained in:
parent
18be645772
commit
530e15d771
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: GNU Affero GPL v3.0
|
title: GNU Affero General Public License v3.0
|
||||||
category: GPL
|
category: GPL
|
||||||
tab-slug: agpl-v3
|
tab-slug: agpl-v3
|
||||||
hide-from-license-list: true
|
hide-from-license-list: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: Simplified BSD
|
title: BSD 2-clause "Simplified" License
|
||||||
category: BSD
|
category: BSD
|
||||||
tab-slug: bsd
|
tab-slug: bsd
|
||||||
hide-from-license-list: true
|
hide-from-license-list: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: New BSD
|
title: BSD 3-clause "New" or "Revised" License
|
||||||
category: BSD
|
category: BSD
|
||||||
tab-slug: bsd-3
|
tab-slug: bsd-3
|
||||||
hide-from-license-list: true
|
hide-from-license-list: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: CC0 1.0 Universal
|
title: Creative Commons Zero v1.0 Universal
|
||||||
category: Public Domain Dedication
|
category: Public Domain Dedication
|
||||||
tab-slug: cc0
|
tab-slug: cc0
|
||||||
permalink: /licenses/cc0/
|
permalink: /licenses/cc0/
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: Eclipse Public License v1.0
|
title: Eclipse Public License 1.0
|
||||||
category: Eclipse
|
category: Eclipse
|
||||||
redirect_from: /licenses/eclipse/
|
redirect_from: /licenses/eclipse/
|
||||||
permalink: /licenses/epl-1.0/
|
permalink: /licenses/epl-1.0/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: GNU GPL v2.0
|
title: GNU General Public License v2.0
|
||||||
category: GPL
|
category: GPL
|
||||||
tab-slug: gpl-v2
|
tab-slug: gpl-v2
|
||||||
hide-from-license-list: false
|
hide-from-license-list: false
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: GNU GPL v3.0
|
title: GNU General Public License v3.0
|
||||||
category: GPL
|
category: GPL
|
||||||
tab-slug: gpl-v3
|
tab-slug: gpl-v3
|
||||||
hide-from-license-list: true
|
hide-from-license-list: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: ISC license
|
title: ISC License
|
||||||
permalink: /licenses/isc/
|
permalink: /licenses/isc/
|
||||||
source: http://opensource.org/licenses/isc-license
|
source: http://opensource.org/licenses/isc-license
|
||||||
category: BSD
|
category: BSD
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: GNU LGPL v2.1
|
title: GNU Lesser General Public License v2.1
|
||||||
category: LGPL
|
category: LGPL
|
||||||
tab-slug: lgpl-v2_1
|
tab-slug: lgpl-v2_1
|
||||||
redirect_from: /licenses/lgpl-v2.1/
|
redirect_from: /licenses/lgpl-v2.1/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: GNU LGPL v3.0
|
title: GNU Lesser General Public License v3.0
|
||||||
category: LGPL
|
category: LGPL
|
||||||
tab-slug: lgpl-v3
|
tab-slug: lgpl-v3
|
||||||
hide-from-license-list: true
|
hide-from-license-list: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: license
|
layout: license
|
||||||
title: Public Domain (Unlicense)
|
title: The Unlicense
|
||||||
category: Public Domain Dedication
|
category: Public Domain Dedication
|
||||||
tab-slug: unlicense
|
tab-slug: unlicense
|
||||||
permalink: /licenses/unlicense/
|
permalink: /licenses/unlicense/
|
||||||
|
@ -10,6 +10,28 @@ licenses.each do |license|
|
|||||||
expect(license["description"]).to_not be_nil
|
expect(license["description"]).to_not be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "SPDX compliance" do
|
||||||
|
# "No license" isn't really a license, so no need to test
|
||||||
|
unless license["id"] == "no-license"
|
||||||
|
it "#{license["id"]} should be a valid SPDX ID" do
|
||||||
|
expect(find_spdx(license["id"])).to_not be_nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be the proper SPDX name" do
|
||||||
|
spdx = find_spdx(license["id"])
|
||||||
|
expect(spdx[1]["name"].gsub(/ only$/,"")).to eql(license["title"])
|
||||||
|
end
|
||||||
|
|
||||||
|
# CC0 and Unlicense are not OSI approved, but that's okay
|
||||||
|
unless license["id"] == "unlicense" || license["id"] == "cc0-1.0"
|
||||||
|
it "should be OSI approved" do
|
||||||
|
spdx = find_spdx(license["id"])
|
||||||
|
expect(spdx[1]["osiApproved"]).to eql(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
["permitted", "required", "forbidden"].each do |group|
|
["permitted", "required", "forbidden"].each do |group|
|
||||||
describe "#{group} properties" do
|
describe "#{group} properties" do
|
||||||
it "should list the properties" do
|
it "should list the properties" do
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
require 'jekyll'
|
require 'jekyll'
|
||||||
|
require 'open-uri'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
def config_file
|
def config_file
|
||||||
File.expand_path "./_config.yml", source
|
File.expand_path "./_config.yml", source
|
||||||
@ -15,7 +17,7 @@ def config
|
|||||||
end
|
end
|
||||||
|
|
||||||
def licenses
|
def licenses
|
||||||
site.collections["licenses"].docs.map { |l| l.data }
|
site.collections["licenses"].docs.map { |l| l.data.merge("id" => l.basename(".txt")) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def site
|
def site
|
||||||
@ -34,3 +36,12 @@ end
|
|||||||
def rule?(tag, group)
|
def rule?(tag, group)
|
||||||
rules[group].any? { |r| r["tag"] == tag }
|
rules[group].any? { |r| r["tag"] == tag }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def spdx_list
|
||||||
|
url = "https://raw.githubusercontent.com/sindresorhus/spdx-license-list/master/spdx.json"
|
||||||
|
$spdx ||= JSON.parse(open(url).read)
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_spdx(license)
|
||||||
|
spdx_list.find { |name, properties| name.downcase == license }
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user