validate SPDX compliance
This commit is contained in:
Родитель
18be645772
Коммит
530e15d771
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: GNU Affero GPL v3.0
|
||||
title: GNU Affero General Public License v3.0
|
||||
category: GPL
|
||||
tab-slug: agpl-v3
|
||||
hide-from-license-list: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: Simplified BSD
|
||||
title: BSD 2-clause "Simplified" License
|
||||
category: BSD
|
||||
tab-slug: bsd
|
||||
hide-from-license-list: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: New BSD
|
||||
title: BSD 3-clause "New" or "Revised" License
|
||||
category: BSD
|
||||
tab-slug: bsd-3
|
||||
hide-from-license-list: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: CC0 1.0 Universal
|
||||
title: Creative Commons Zero v1.0 Universal
|
||||
category: Public Domain Dedication
|
||||
tab-slug: cc0
|
||||
permalink: /licenses/cc0/
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: Eclipse Public License v1.0
|
||||
title: Eclipse Public License 1.0
|
||||
category: Eclipse
|
||||
redirect_from: /licenses/eclipse/
|
||||
permalink: /licenses/epl-1.0/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: GNU GPL v2.0
|
||||
title: GNU General Public License v2.0
|
||||
category: GPL
|
||||
tab-slug: gpl-v2
|
||||
hide-from-license-list: false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: GNU GPL v3.0
|
||||
title: GNU General Public License v3.0
|
||||
category: GPL
|
||||
tab-slug: gpl-v3
|
||||
hide-from-license-list: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: ISC license
|
||||
title: ISC License
|
||||
permalink: /licenses/isc/
|
||||
source: http://opensource.org/licenses/isc-license
|
||||
category: BSD
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: GNU LGPL v2.1
|
||||
title: GNU Lesser General Public License v2.1
|
||||
category: LGPL
|
||||
tab-slug: lgpl-v2_1
|
||||
redirect_from: /licenses/lgpl-v2.1/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: GNU LGPL v3.0
|
||||
title: GNU Lesser General Public License v3.0
|
||||
category: LGPL
|
||||
tab-slug: lgpl-v3
|
||||
hide-from-license-list: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: license
|
||||
title: Public Domain (Unlicense)
|
||||
title: The Unlicense
|
||||
category: Public Domain Dedication
|
||||
tab-slug: unlicense
|
||||
permalink: /licenses/unlicense/
|
||||
|
|
|
@ -10,6 +10,28 @@ licenses.each do |license|
|
|||
expect(license["description"]).to_not be_nil
|
||||
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|
|
||||
describe "#{group} properties" do
|
||||
it "should list the properties" do
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
require 'jekyll'
|
||||
require 'open-uri'
|
||||
require 'json'
|
||||
|
||||
def config_file
|
||||
File.expand_path "./_config.yml", source
|
||||
|
@ -15,7 +17,7 @@ def config
|
|||
end
|
||||
|
||||
def licenses
|
||||
site.collections["licenses"].docs.map { |l| l.data }
|
||||
site.collections["licenses"].docs.map { |l| l.data.merge("id" => l.basename(".txt")) }
|
||||
end
|
||||
|
||||
def site
|
||||
|
@ -34,3 +36,12 @@ end
|
|||
def rule?(tag, group)
|
||||
rules[group].any? { |r| r["tag"] == tag }
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче