1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 12:50:24 +01:00

Merge branch 'gh-pages' into gh-pages

This commit is contained in:
Emidio 2016-01-27 09:55:26 +01:00
commit ec929eb17d
31 changed files with 154 additions and 87 deletions

View File

@ -18,7 +18,7 @@ defaults:
values: values:
layout: license layout: license
featured: false featured: false
hidden: false hidden: true
variant: false variant: false
exclude: exclude:
@ -41,7 +41,7 @@ gems:
- jekyll-sitemap - jekyll-sitemap
- jekyll-redirect-from - jekyll-redirect-from
- jekyll-seo-tag - jekyll-seo-tag
sass: sass:
sass_dir: _sass sass_dir: _sass
style: :compressed style: :compressed

View File

@ -4,8 +4,6 @@ source: http://opensource.org/licenses/afl-3.0
description: The Academic Free License is a variant of the Open Source License that does not require that the source code of derivative works be disclosed. It contains explicit copyright and patent grants and reserves trademark rights in the author. description: The Academic Free License is a variant of the Open Source License that does not require that the source code of derivative works be disclosed. It contains explicit copyright and patent grants and reserves trademark rights in the author.
hidden: true
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Files licensed under OSL 3.0 must also include the notice "Licensed under the Academic Free License version 3.0" adjacent to the copyright notice. how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Files licensed under OSL 3.0 must also include the notice "Licensed under the Academic Free License version 3.0" adjacent to the copyright notice.
required: required:

View File

@ -30,6 +30,7 @@ forbidden:
- no-liability - no-liability
- no-sublicense - no-sublicense
hidden: false
--- ---
GNU AFFERO GENERAL PUBLIC LICENSE GNU AFFERO GENERAL PUBLIC LICENSE

View File

@ -27,6 +27,7 @@ forbidden:
- trademark-use - trademark-use
- no-liability - no-liability
hidden: false
--- ---
Apache License Apache License

View File

@ -22,6 +22,7 @@ forbidden:
- no-liability - no-liability
- trademark-use - trademark-use
hidden: false
--- ---
The Artistic License 2.0 The Artistic License 2.0

View File

@ -24,6 +24,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
Copyright (c) [year], [fullname] Copyright (c) [year], [fullname]

View File

@ -1,7 +1,6 @@
--- ---
title: BSD 3-clause Clear License title: BSD 3-clause Clear License
nickname: Clear BSD nickname: Clear BSD
hidden: true
family: BSD family: BSD
tab-slug: bsd-3-clear tab-slug: bsd-3-clear

View File

@ -23,6 +23,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
Copyright (c) [year], [fullname] Copyright (c) [year], [fullname]

View File

@ -25,6 +25,7 @@ forbidden:
required: [] required: []
hidden: false
--- ---
CC0 1.0 Universal CC0 1.0 Universal

View File

@ -30,6 +30,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
Eclipse Public License - v 1.0 Eclipse Public License - v 1.0

View File

@ -29,6 +29,7 @@ forbidden:
- no-liability - no-liability
- no-sublicense - no-sublicense
hidden: false
--- ---
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE

View File

@ -28,6 +28,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE

View File

@ -21,6 +21,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
Copyright (c) [year], [fullname] Copyright (c) [year], [fullname]

View File

@ -29,6 +29,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
GNU LESSER GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE

View File

@ -28,6 +28,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
GNU LESSER GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE

View File

@ -20,6 +20,7 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
hidden: false
--- ---
The MIT License (MIT) The MIT License (MIT)

View File

@ -23,6 +23,7 @@ forbidden:
- no-liability - no-liability
- trademark-use - trademark-use
hidden: false
--- ---
Mozilla Public License Version 2.0 Mozilla Public License Version 2.0

View File

@ -1,6 +1,5 @@
--- ---
title: Microsoft Public License title: Microsoft Public License
hidden: true
source: http://opensource.org/licenses/ms-pl source: http://opensource.org/licenses/ms-pl

View File

@ -1,6 +1,5 @@
--- ---
title: Microsoft Reciprocal License title: Microsoft Reciprocal License
hidden: true
source: http://opensource.org/licenses/ms-pl source: http://opensource.org/licenses/ms-pl

View File

@ -20,6 +20,7 @@ forbidden:
- distribution - distribution
- sublicense - sublicense
hidden: false
--- ---
Copyright [year] [fullname] Copyright [year] [fullname]

View File

@ -1,7 +1,6 @@
--- ---
title: SIL Open Font License 1.1 title: SIL Open Font License 1.1
redirect_from: /licenses/ofl/ redirect_from: /licenses/ofl/
hidden: true
source: http://scripts.sil.org/OFL_web source: http://scripts.sil.org/OFL_web
description: The Open Font License (OFL) is maintained by SIL International. It attempts to be a compromise between the values of the free software and typeface design communities. It is used for almost all open source font projects, including those by Adobe, Google and Mozilla. description: The Open Font License (OFL) is maintained by SIL International. It attempts to be a compromise between the values of the free software and typeface design communities. It is used for almost all open source font projects, including those by Adobe, Google and Mozilla.

View File

@ -1,6 +1,5 @@
--- ---
title: Open Software License 3.0 title: Open Software License 3.0
hidden: true
source: http://opensource.org/licenses/OSL-3.0 source: http://opensource.org/licenses/OSL-3.0
description: OSL 3.0 is a copyleft license that does not require reciprocal licensing on linked works. It also provides an express grant of patent rights from contributors to users, with a termination clause triggered if a user files a patent infringement lawsuit. description: OSL 3.0 is a copyleft license that does not require reciprocal licensing on linked works. It also provides an express grant of patent rights from contributors to users, with a termination clause triggered if a user files a patent infringement lawsuit.

View File

@ -22,6 +22,7 @@ forbidden:
required: [] required: []
hidden: false
--- ---
This is free and unencumbered software released into the public domain. This is free and unencumbered software released into the public domain.

View File

@ -1,6 +1,5 @@
--- ---
title: "Do What The F*ck You Want To Public License" title: "Do What The F*ck You Want To Public License"
hidden: true
source: http://www.wtfpl.net/ source: http://www.wtfpl.net/
description: The easiest licence out there. It gives the user permissions to do whatever they want with your code. description: The easiest licence out there. It gives the user permissions to do whatever they want with your code.

View File

@ -1,29 +1,31 @@
require 'spec_helper' require 'spec_helper'
families.each do |family| describe "license categories" do
describe "the #{family} family" do families.each do |family|
family_licenses = licenses.select { |l| l["family"] == family } context "the #{family} family" do
primary = family_licenses.select { |l| l["variant"] == false } family_licenses = licenses.select { |l| l["family"] == family }
variants = family_licenses.select { |l| l["variant"] == true } primary = family_licenses.select { |l| l["variant"] == false }
variants = family_licenses.select { |l| l["variant"] == true }
it "should only have one primary license" do it "should only have one primary license" do
expect(primary.count).to eql(1) expect(primary.count).to eql(1)
end end
it "all other licenses should be variants" do it "all other licenses should be variants" do
expected = family_licenses.count - 1 expected = family_licenses.count - 1
expect(variants.count).to eql(expected) expect(variants.count).to eql(expected)
end end
family_licenses.each do |license| family_licenses.each do |license|
describe "the #{license["title"]} license" do context "the #{license["title"]} license" do
it "should have a unique slug" do it "should have a unique slug" do
dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
expect(dupes).to eql(1) expect(dupes).to eql(1)
end end
it "should have a valid tab-slug" do it "should have a valid tab-slug" do
expect(license["tab-slug"]).to match(/[a-z0-9_]/) expect(license["tab-slug"]).to match(/[a-z0-9_]/)
end
end end
end end
end end

View File

@ -1,11 +1,13 @@
require 'spec_helper' require 'spec_helper'
licenses.each do |license| describe "license fillable fields" do
describe "The #{license["title"]} license" do licenses.each do |license|
it "should only contain supported fields" do context "The #{license["title"]} license" do
matches = license["content"].scan /\[([a-z]+)\]/ it "should only contain supported fillable fields" do
extra_fields = matches.flatten - fields.map { |f| f["name"] } matches = license["content"].scan(/\[([a-z]+)\]/)
expect(extra_fields).to be_empty extra_fields = matches.flatten - fields.map { |f| f["name"] }
expect(extra_fields).to be_empty
end
end end
end end
end end

View File

@ -1,31 +1,33 @@
require 'spec_helper' require 'spec_helper'
licenses.each do |license| describe "license meta" do
licenses.each do |license|
# Manually load the raw license so we don't get thed defaults # Manually load the raw license so we don't get thed defaults
raw_fields = SafeYAML.load_file("_licenses/#{license["id"]}.txt") raw_fields = SafeYAML.load_file("_licenses/#{license["id"]}.txt")
describe "The #{license["title"]} license" do context "The #{license["title"]} license" do
it "should only contain supported meta fields" do it "should only contain supported meta fields" do
extra_fields = raw_fields.keys - meta.map { |m| m["name"] } extra_fields = raw_fields.keys - meta.map { |m| m["name"] }
expect(extra_fields).to be_empty expect(extra_fields).to be_empty
end end
it "should contain all required meta fields" do it "should contain all required meta fields" do
required = meta.select { |m| m["required"] }.map { |m| m["name"] } required = meta.select { |m| m["required"] }.map { |m| m["name"] }
missing = required - raw_fields.keys missing = required - raw_fields.keys
expect(missing).to be_empty
end
if license["family"]
it "should contain the required license variant fields" do
missing = ["family", "tab-slug"] - license.keys
expect(missing).to be_empty expect(missing).to be_empty
end end
else
it "should not contain license family specific fields" do if license["family"]
extra = ["variant", "family", "tab-slug"].select{ |f| raw_fields.keys.include?(f) } it "should contain the required license variant fields" do
expect(extra).to be_empty missing = ["family", "tab-slug"] - license.keys
expect(missing).to be_empty
end
else
it "should not contain license family specific fields" do
extra = ["variant", "family", "tab-slug"].select{ |f| raw_fields.keys.include?(f) }
expect(extra).to be_empty
end
end end
end end
end end

View File

@ -1,22 +1,24 @@
require 'spec_helper' require 'spec_helper'
licenses.each do |license| describe "license rules" do
licenses.each do |license|
groups = rules.keys groups = rules.keys
describe "The #{license["title"]} license" do context "The #{license["title"]} license" do
groups.each do |group| groups.each do |group|
valid_tags = rules[group].map { |r| r["tag"] } valid_tags = rules[group].map { |r| r["tag"] }
describe "the #{group} group" do context "the #{group} group" do
it "should exist" do it "should exist" do
expect(license[group]).to_not be_nil expect(license[group]).to_not be_nil
end end
it "should only contain valid tags" do it "should only contain valid tags" do
extra = license[group] - valid_tags extra = license[group] - valid_tags
expect(extra).to be_empty expect(extra).to be_empty
end
end end
end end
end end

View File

@ -0,0 +1,37 @@
require 'spec_helper'
describe "shown licenses" do
# Whitelist of popular licenses that are shown (non-hidden)
# Note: most new licenses that are added should be hidden by default
SHOWN_LICENSES = %w[
agpl-3.0
apache-2.0
artistic-2.0
bsd-2-clause
bsd-3-clause
cc0-1.0
epl-1.0
gpl-2.0
gpl-3.0
isc
lgpl-2.1
lgpl-3.0
mit
mpl-2.0
no-license
unlicense
]
it "has the expected number of shown licenses" do
expect(shown_licenses.count).to eql(16)
end
shown_licenses.each do |license|
context "the #{license["title"]} license" do
it "is whitelisted to be shown" do
expect(SHOWN_LICENSES).to include(license["id"])
end
end
end
end

View File

@ -1,26 +1,30 @@
require 'spec_helper' require 'spec_helper'
licenses.each do |license| describe "licenses" do
# "No license" isn't really a license, so no need to test licenses.each do |license|
next if license["id"] == "no-license"
describe "The #{license["title"]} license" do # "No license" isn't really a license, so no need to test
next if license["id"] == "no-license"
let(:id) { license["id"] } context "The #{license["title"]} license" do
it "has an SPDX ID" do let(:id) { license["id"] }
expect(spdx_ids).to include(id)
end
it "uses its SPDX name" do it "has an SPDX ID" do
spdx = find_spdx(id) expect(spdx_ids).to include(id)
expect(spdx[1]["name"].gsub(/ only$/,"")).to eql(license["title"]) end
end
context "industry approval" do it "uses its SPDX name" do
it "should be approved by OSI or FSF or OD" do spdx = find_spdx(id)
expect(approved_licenses).to include(id), "See https://git.io/vzCTV." expect(spdx).to_not be_nil
expect(spdx[1]["name"].gsub(/ only$/,"")).to eql(license["title"])
end
context "industry approval" do
it "should be approved by OSI or FSF or OD" do
expect(approved_licenses).to include(id), "See https://git.io/vzCTV."
end
end end
end end
end end

View File

@ -19,12 +19,22 @@ def config
end end
def licenses def licenses
site.collections["licenses"].docs.map do |license| $licenses ||= begin
id = File.basename(license.basename, ".txt") site.collections["licenses"].docs.map do |license|
license.to_liquid.merge("id" => id) id = File.basename(license.basename, ".txt")
license.to_liquid.merge("id" => id)
end
end end
end end
def hidden_licenses
licenses.select { |l| l["hidden"] }
end
def shown_licenses
licenses.select { |l| !l["hidden"] }
end
def license_ids def license_ids
licenses.map { |l| l["id"] } licenses.map { |l| l["id"] }
end end