From c9bf0edc206c250a12b4398f940e130cd3731036 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 19 Aug 2015 16:19:37 -0400 Subject: [PATCH 01/11] rename ofl so tests pass --- _licenses/{ofl.txt => ofl-1.1.txt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename _licenses/{ofl.txt => ofl-1.1.txt} (99%) diff --git a/_licenses/ofl.txt b/_licenses/ofl-1.1.txt similarity index 99% rename from _licenses/ofl.txt rename to _licenses/ofl-1.1.txt index b50db57..20ca4a8 100644 --- a/_licenses/ofl.txt +++ b/_licenses/ofl-1.1.txt @@ -72,7 +72,7 @@ new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. -PERMISSION & CONDITIONS +PERMISSION AND CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font From ca7c100e2a4a6b14a144a928e0f00bfca7f63249 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 19 Aug 2015 16:19:59 -0400 Subject: [PATCH 02/11] fix ofl title --- _licenses/ofl-1.1.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_licenses/ofl-1.1.txt b/_licenses/ofl-1.1.txt index 20ca4a8..a506c7f 100644 --- a/_licenses/ofl-1.1.txt +++ b/_licenses/ofl-1.1.txt @@ -1,6 +1,6 @@ --- layout: license -title: SIL Open Font License +title: SIL Open Font License 1.1 hidden: true permalink: /licenses/ofl/ From 7601d76816c41412e22faf35fd55f669177e87a8 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 19 Aug 2015 16:25:47 -0400 Subject: [PATCH 03/11] smart license list filtering --- _includes/license-overview.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/_includes/license-overview.html b/_includes/license-overview.html index 9a00d6e..32c0b9f 100644 --- a/_includes/license-overview.html +++ b/_includes/license-overview.html @@ -14,8 +14,8 @@ {% if license.tab-slug %} {% endif %} - {% for variation in site.licenses %} - {% if variation.category and variation.category == license.category %} + {% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %} + {% for variation in variations %}
@@ -59,7 +58,6 @@

View full {{ variation.title }} license »

- {% endif %} {% endfor %} From 5c47718e720e875154e9f01a905b7c2b3df9d695 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 19 Aug 2015 16:46:40 -0400 Subject: [PATCH 04/11] fix up wtfpl; --- licenses/WTFPL.txt => _licenses/wtfpl.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) rename licenses/WTFPL.txt => _licenses/wtfpl.txt (78%) diff --git a/licenses/WTFPL.txt b/_licenses/wtfpl.txt similarity index 78% rename from licenses/WTFPL.txt rename to _licenses/wtfpl.txt index 76f27eb..ed425f6 100644 --- a/licenses/WTFPL.txt +++ b/_licenses/wtfpl.txt @@ -1,6 +1,6 @@ --- layout: license -title: Do What the F*** You Want to Public License +title: "Do What The F*ck You Want To Public License" category: WTFPL permalink: /licenses/wtfpl/ hidden: true @@ -8,23 +8,25 @@ source: http://www.wtfpl.net/ description: The easiest licence out there. It gives the user permissions to do whatever they want with your code. -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. +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. -required: - - nothing +required: [] permitted: - - everything + - commercial-use + - modifications + - distribution + - sublicense + - private-use -forbidden: - - nothing +forbidden: [] --- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 - Copyright (C) 2004 Sam Hocevar + Copyright (C) 2004 [fullname] <[email]> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long From 4b536ab4174a542dbfac7ee180d17349bf84d25d Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Wed, 19 Aug 2015 17:30:11 -0400 Subject: [PATCH 05/11] remove OSI appoval requirement --- spec/license_spec.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 25efd5e..3dd2e37 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -21,14 +21,6 @@ licenses.each do |license| 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 From 2029405007656c38bb5641e8e1d7d55d42753cba Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 12:36:56 -0400 Subject: [PATCH 06/11] Revert "remove OSI appoval requirement" This reverts commit 4b536ab4174a542dbfac7ee180d17349bf84d25d. --- spec/license_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 3dd2e37..25efd5e 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -21,6 +21,14 @@ licenses.each do |license| 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 From 8c63910daa5f8f7b2ec37cd97536c278904318cb Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 12:41:30 -0400 Subject: [PATCH 07/11] formalize whitelist --- spec/license_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 25efd5e..02c5469 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -1,5 +1,13 @@ require 'spec_helper' +# List of licenses that need not be OSI approved +LICENSE_WHITELIST = %w[ + unlicense + cc0-1.0 + wtfpl +] + + licenses.each do |license| describe "The #{license["title"]} license" do it "should have a title" do @@ -23,10 +31,11 @@ licenses.each do |license| end # CC0 and Unlicense are not OSI approved, but that's okay - unless license["id"] == "unlicense" || license["id"] == "cc0-1.0" + unless LICENSE_WHITELIST.include? license["id"] it "should be OSI approved" do spdx = find_spdx(license["id"]) - expect(spdx[1]["osiApproved"]).to eql(true) + approved = spdx[1]["osiApproved"] + expect(approved).to eql(true) end end end From 915c08b821c982f133b3553497709641f85c22b5 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 15:25:16 -0400 Subject: [PATCH 08/11] move meta and fields to yaml --- README.md | 128 +++++++++++++++++++------------- _data/fields.yml | 23 ++++++ _data/meta.yml | 68 +++++++++++++++++ _includes/license-overview.html | 24 ++++-- _licenses/agpl-3.0.txt | 2 - _licenses/apache-2.0.txt | 7 +- _licenses/artistic-2.0.txt | 3 - _licenses/bsd-2-clause.txt | 2 - _licenses/bsd-3-clause.txt | 2 - _licenses/cc0-1.0.txt | 8 +- _licenses/epl-1.0.txt | 3 - _licenses/gpl-2.0.txt | 8 +- _licenses/gpl-3.0.txt | 2 - _licenses/isc.txt | 5 +- _licenses/lgpl-2.1.txt | 7 +- _licenses/lgpl-3.0.txt | 2 - _licenses/mit.txt | 4 - _licenses/mpl-2.0.txt | 3 - _licenses/no-license.txt | 7 +- _licenses/ofl-1.1.txt | 3 +- _licenses/osl-3.0.txt | 3 - _licenses/unlicense.txt | 8 +- _licenses/wtfpl.txt | 3 - licenses.html | 4 +- script/generate-docs | 36 +++++++++ spec/category_spec.rb | 31 ++++++++ spec/license_fields_spec.rb | 11 +++ spec/license_meta_spec.rb | 32 ++++++++ spec/license_spec.rb | 8 -- spec/spec_helper.rb | 14 +++- 30 files changed, 330 insertions(+), 131 deletions(-) create mode 100644 _data/fields.yml create mode 100644 _data/meta.yml create mode 100755 script/generate-docs create mode 100644 spec/category_spec.rb create mode 100644 spec/license_fields_spec.rb create mode 100644 spec/license_meta_spec.rb diff --git a/README.md b/README.md index 732dd4e..e78057a 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,24 @@ -# Choose a License Web Site [![Build Status](https://travis-ci.org/github/choosealicense.com.png?branch=gh-pages)](https://travis-ci.org/github/choosealicense.com) +# Choosealicense.com + +[![Build Status](https://travis-ci.org/github/choosealicense.com.png?branch=gh-pages)](https://travis-ci.org/github/choosealicense.com) Like a Choose Your Own Adventure site, but only much less interesting. -# Intro +## Intro -A lot of repositories on GitHub.com don't have a license. GitHub provides -a license chooser, but if you don't know anything about licenses, how are you -supposed to make an informed decision? +A lot of repositories on GitHub.com don't have a license. GitHub provides a license chooser, but if you don't know anything about licenses, how are you supposed to make an informed decision? -[ChooseALicense.com](http://www.choosealicense.com "Choose A Licence website") is designed to help people make an informed decision about -licenses. +[ChooseALicense.com](http://www.choosealicense.com "Choose A Licence website") is designed to help people make an informed decision about licenses. -# Immediate Goals +## Immediate Goals * Non-partisan. Our goal is to help you find a license that meets *your* goals. * Well designed, but that goes without saying. * The homepage should have just enough to help 99% of folks make a decision. -* For the 1%, the site will contain a list of licenses common to specific -communities and situations. -* Not comprehensive. Seems like an odd goal, but there are a bajillion -licenses out there. We're going to have to filter that down to a -small list of those that matter. +* For the 1%, the site will contain a list of licenses common to specific communities and situations. +* Not comprehensive. Seems like an odd goal, but there are a bajillion licenses out there. We're going to have to filter that down to a small list of those that matter. -# Run It On Your Machine +## Run It On Your Machine ```bash git clone https://github.com/github/choosealicense.com.git @@ -32,48 +28,80 @@ script/server ``` Open `http://localhost:4000` in your favorite browser. -# Adding a license +## Adding a license -The text of the license should be wrapped to a 78 character width. +Licenses sit in the `/_licenses` folder. The text of the license should be wrapped to a 78 character width. Each license has YAML front matter describing the license's properties. The body of the file should be the text of the license in plain text. The available metadata fields are: -Licenses sit in the `/licenses` folder. Each license has YAML front matter -describing the license's properties. The body of the file should be the text -of the license in plain text. The available metadata fields are: +### YAML front matter -* `title` - The name of the license -* `layout` - This should be `license` -* `permalink` - The absolute URL to the license, beginning with `/licenses/` -* `source` - URL to the license source text -* `note` - The note field in the sidebar (optional) -* `how` - How to use the license, also in the sidebar -* `required`, `permitted`, `forbidden` - bulleted list of rules applicable to the license (see below) -* `filename` - The filename to be created on GitHub.com when a repository is initialized with this license. +#### Required fields -The licenses on choosealicense.com are regularly imported to GitHub.com to be -used as the list of licenses available when creating a repository. When we -create a repository, we will replace certain strings in the license with -variables from the repository. These can be used to create accurate copyright -notices. The available variables are: +* `title` - The SPDX-compliant, human-readable license name +* `source` - The URL to the license source text +* `description` - A human-readable description of the license +* `how` - Instructions on how to implement the license +* `required` - Bulleted list of required rules +* `permitted` - Bulleted list of permitted rules +* `forbidden` - Bulleted list of forbidden rules -* `[fullname]` - The full name or username of the repository owner -* `[login]` - The repository owner's username -* `[email]` - The repository owner's primary email address -* `[project]` - The repository name -* `[description]` - The description of the repository -* `[year]` - The current year +#### Optional fields -# Rules +* `note` - Additional information about the licenses +* `using` - A list of notable projects using the license in the form of `project_name: "url"` +* `hidden` - Whether the license is hidden from the license list (defaults to false) +* `redirect_from` - Relative path(s) to redirect to the license from +* `featured` - Whether the license should be featured on the main page (defaults to false) +* `nickname` - A shorter, human-readable license name where the SPDX license name is long +* `variant` - Whether the license is a variant of a family of licenses (e.g., GPL) +* `category` - If part of a license family, the name of the license family (e.g., `GPL`) +* `tab-slug` - If part of a license family, a license slug containing only `a-z`, `0-9`, and `_` characters -Rules (the license's properties) are stored as a bulleted list within the -licenses YAML front matter. A full list of rules can be found in `_data/rules.yml`. -Each rule has a name e.g., `include-copyright`, a human-readable label, e.g., -`Copyright inclusion`, and a description `Include the original copyright with the code`. -To add a new rule, simply add it to `_data/rules.yml` and reference it in the -appropriate license. +### Auto-populated fields -# License +The licenses on choosealicense.com are regularly imported to GitHub.com to be used as the list of licenses available when creating a repository. When we create a repository, we will replace certain strings in the license with variables from the repository. These can be used to create accurate copyright notices. The available variables are: -The content of this project itself is licensed under the -[Creative Commons Attribution 3.0 license](http://creativecommons.org/licenses/by/3.0/us/deed.en_US), -and the underlying source code used to format and display that content -is licensed under the [MIT license](http://opensource.org/licenses/mit-license.php). +#### Fields + +* `fullname` - The full name or username of the repository owner +* `login` - The repository owner's username +* `email` - The repository owner's primary email address +* `project` - The repository name +* `description` - The description of the repository +* `year` - The current year + +## License properties + +The license properties (rules) are stored as a bulleted list within the licenses YAML front matter. Each rule has a name e.g., `include-copyright`, a human-readable label, e.g., `Copyright inclusion`, and a description `Include the original copyright with the code`. To add a new rule, simply add it to `_data/rules.yml` and reference it in the appropriate license. + +### Rules + +#### Required + +* `include-copyright` - Include a copy of the license and copyright notice with the code. +* `document-changes` - Indicate significant changes made to the code. +* `disclose-source` - Source code must be made available when distributing the software. In the case of LGPL and OSL 3.0, the source for the library (and not the entire program) must be made available. +* `network-use-disclose` - Users who interact with the software via network are given the right to receive a copy of the corresponding source code. +* `library-usage` - The library may be used within a non-open-source application. +* `rename` - You must change the name of the software if you modify it. + +#### Permitted + +* `commercial-use` - This software and derivatives may be used for commercial purposes. +* `modifications` - This software may be modified. +* `distribution` - You may distribute this software. +* `sublicense` - You may grant a sublicense to modify and distribute this software to third parties not included in the license. +* `private-use` - You may use and modify the software without distributing it. +* `patent-grant` - This license provides an express grant of patent rights from the contributor to the recipient. + +#### Forbidden + +* `trademark-use` - While this may be implicitly true of all licenses, this license explicitly states that you may NOT use the names, logos, or trademarks of contributors. +* `no-liability` - Software is provided without warranty and the software author/license owner cannot be held liable for damages. +* `no-sublicense` - You may not grant a sublicense to modify and distribute this software to third parties not included in the license. +* `modifications` - This software may not be modified. +* `distribution` - You may not distribute this software. +* `sublicense` - You may not grant a sublicense to modify and distribute this software to third parties not included in the license. + +## License + +The content of this project itself is licensed under the [Creative Commons Attribution 3.0 license](http://creativecommons.org/licenses/by/3.0/us/deed.en_US), and the underlying source code used to format and display that content is licensed under the [MIT license](http://opensource.org/licenses/mit-license.php). diff --git a/_data/fields.yml b/_data/fields.yml new file mode 100644 index 0000000..0b5f45d --- /dev/null +++ b/_data/fields.yml @@ -0,0 +1,23 @@ +# The licenses on choosealicense.com are regularly imported to GitHub.com to +# be used as the list of licenses available when creating a repository. When +# we create a repository, we will replace certain strings in the license with +# variables from the repository. These can be used to create accurate copyright +# notices. The available variables are: + +- name: fullname + description: The full name or username of the repository owner + +- name: login + description: The repository owner's username + +- name: email + description: The repository owner's primary email address + +- name: project + description: The repository name + +- name: description + description: The description of the repository + +- name: year + description: The current year diff --git a/_data/meta.yml b/_data/meta.yml new file mode 100644 index 0000000..99b1d01 --- /dev/null +++ b/_data/meta.yml @@ -0,0 +1,68 @@ +# Each license has YAML front matter describing the license's properties. +# The available fields are: + +- name: title + description: The SPDX-compliant, human-readable license name + required: true + +- name: source + description: The URL to the license source text + required: true + +- name: description + description: A human-readable description of the license + required: true + +- name: how + description: Instructions on how to implement the license + required: true + +- name: required + description: Bulleted list of required rules + required: true + +- name: permitted + description: Bulleted list of permitted rules + required: true + +- name: forbidden + description: Bulleted list of forbidden rules + required: true + +# Optional fields + +- name: note + description: Additional information about the licenses + required: false + +- name: using + description: 'A list of notable projects using the license in the form of `project_name: "url"`' + required: false + +- name: hidden + description: Whether the license is hidden from the license list (defaults to false) + required: false + +- name: redirect_from + description: Relative path(s) to redirect to the license from + required: false + +- name: featured + description: Whether the license should be featured on the main page (defaults to false) + required: false + +- name: nickname + description: A shorter, human-readable license name where the SPDX license name is long + required: false + +- name: variant + description: Whether the license is a variant of a family of licenses (e.g., GPL) + required: false + +- name: category + description: If part of a license family, the name of the license family (e.g., `GPL`) + required: false + +- name: tab-slug + description: If part of a license family, a license slug containing only `a-z`, `0-9`, and `_` characters + required: false diff --git a/_includes/license-overview.html b/_includes/license-overview.html index 32c0b9f..8b8c6a1 100644 --- a/_includes/license-overview.html +++ b/_includes/license-overview.html @@ -1,8 +1,16 @@

- - {% if license.category %}{{ license.category }}{% else %}{{ license.title }}{% endif %} + + {% if license.category %} + {{ license.category }} + {% else %} + {% if license.nickname %} + {{ license.nickname }} + {% else %} + {{ license.title }} + {% endif %} + {% endif %}

@@ -12,7 +20,7 @@
- {% if license.tab-slug %} + {% if license.category %} {% endif %}
- {% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %} + + {% if license.category %} + {% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %} + {% else %} + {% assign variations = site.licenses | where:"title",license.title %} + {% endif %} + {% for variation in variations %} {% endfor %}
diff --git a/_licenses/agpl-3.0.txt b/_licenses/agpl-3.0.txt index 0922c55..09d1220 100644 --- a/_licenses/agpl-3.0.txt +++ b/_licenses/agpl-3.0.txt @@ -4,8 +4,6 @@ nickname: GNU Affero GPL v3.0 category: GPL tab-slug: agpl-v3 variant: true -layout: license -permalink: /licenses/agpl-3.0/ source: http://www.gnu.org/licenses/agpl-3.0.txt redirect_from: /licenses/agpl/ diff --git a/_licenses/apache-2.0.txt b/_licenses/apache-2.0.txt index 37d448e..6d2b182 100644 --- a/_licenses/apache-2.0.txt +++ b/_licenses/apache-2.0.txt @@ -1,11 +1,8 @@ --- title: Apache License 2.0 -category: Apache -layout: license -permalink: /licenses/apache-2.0/ redirect_from: /licenses/apache/ - featured: true +nickname: Apache description: A permissive license that also provides an express grant of patent rights from contributors to users. @@ -18,7 +15,7 @@ source: http://www.apache.org/licenses/LICENSE-2.0.html required: - include-copyright - document-changes - + permitted: - commercial-use - modifications diff --git a/_licenses/artistic-2.0.txt b/_licenses/artistic-2.0.txt index d4985b9..02f75a6 100644 --- a/_licenses/artistic-2.0.txt +++ b/_licenses/artistic-2.0.txt @@ -1,10 +1,7 @@ --- -layout: license title: Artistic License 2.0 -category: Artistic redirect_from: /licenses/artistic/ source: http://www.perlfoundation.org/attachment/legal/artistic-2_0.txt -permalink: /licenses/artistic-2.0/ description: Heavily favored by the Perl community, the Artistic license requires that modified versions of the software do not prevent users from running the standard version. diff --git a/_licenses/bsd-2-clause.txt b/_licenses/bsd-2-clause.txt index 1094c05..d0d38dc 100644 --- a/_licenses/bsd-2-clause.txt +++ b/_licenses/bsd-2-clause.txt @@ -1,12 +1,10 @@ --- -layout: license title: BSD 2-clause "Simplified" License nickname: Simplified BSD category: BSD tab-slug: bsd variant: true redirect_from: /licenses/bsd/ -permalink: /licenses/bsd-2-clause/ description: A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. diff --git a/_licenses/bsd-3-clause.txt b/_licenses/bsd-3-clause.txt index 4756aae..9280868 100644 --- a/_licenses/bsd-3-clause.txt +++ b/_licenses/bsd-3-clause.txt @@ -1,11 +1,9 @@ --- -layout: license title: BSD 3-clause "New" or "Revised" License nickname: New BSD category: BSD tab-slug: bsd-3 variant: true -permalink: /licenses/bsd-3-clause/ description: A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. The three clause variant prohibits others from using the name of the project or its contributors to promote derivative works without written consent. diff --git a/_licenses/cc0-1.0.txt b/_licenses/cc0-1.0.txt index ec0559f..9bf170a 100644 --- a/_licenses/cc0-1.0.txt +++ b/_licenses/cc0-1.0.txt @@ -1,13 +1,11 @@ --- -layout: license title: Creative Commons Zero v1.0 Universal nickname: CC0 1.0 Universal -category: Public Domain Dedication +redirect_from: /licenses/cc0/ + tab-slug: cc0 -permalink: /licenses/cc0/ -class: license-types +category: Public Domain Dedication variant: true -filename: LICENSE source: http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/_licenses/epl-1.0.txt b/_licenses/epl-1.0.txt index 62f0ab5..3d10f85 100644 --- a/_licenses/epl-1.0.txt +++ b/_licenses/epl-1.0.txt @@ -1,9 +1,6 @@ --- -layout: license title: Eclipse Public License 1.0 -category: Eclipse redirect_from: /licenses/eclipse/ -permalink: /licenses/epl-1.0/ description: This commercially-friendly copyleft license provides the ability to commercially license binaries; a modern royalty-free patent license grant; and the ability for linked works to use other licenses, including commercial ones. diff --git a/_licenses/gpl-2.0.txt b/_licenses/gpl-2.0.txt index 79bbc7d..90b1f8c 100644 --- a/_licenses/gpl-2.0.txt +++ b/_licenses/gpl-2.0.txt @@ -1,14 +1,12 @@ --- title: GNU General Public License v2.0 nickname: GNU GPL v2.0 -category: GPL -tab-slug: gpl-v2 -variant: false -layout: license -permalink: /licenses/gpl-2.0/ redirect_from: /licenses/gpl-v2/ source: http://www.gnu.org/licenses/gpl-2.0.txt +category: GPL +tab-slug: gpl-v2 + description: GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license. There are multiple variants of the GPL, each with different requirements. featured: true diff --git a/_licenses/gpl-3.0.txt b/_licenses/gpl-3.0.txt index beedee8..2d07cf9 100644 --- a/_licenses/gpl-3.0.txt +++ b/_licenses/gpl-3.0.txt @@ -4,8 +4,6 @@ nickname: GNU GPL v3.0 category: GPL tab-slug: gpl-v3 variant: true -layout: license -permalink: /licenses/gpl-3.0/ redirect_from: /licenses/gpl-v3/ source: http://www.gnu.org/licenses/gpl-3.0.txt diff --git a/_licenses/isc.txt b/_licenses/isc.txt index 8dd8e38..5c2fb35 100644 --- a/_licenses/isc.txt +++ b/_licenses/isc.txt @@ -1,8 +1,7 @@ --- -layout: license title: ISC License -permalink: /licenses/isc/ source: http://opensource.org/licenses/isc-license + category: BSD tab-slug: isc @@ -10,8 +9,6 @@ description: A permissive license lets people do anything with your code with pr 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. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders. [email] is optional but recommended. -filename: LICENSE - required: - include-copyright diff --git a/_licenses/lgpl-2.1.txt b/_licenses/lgpl-2.1.txt index e4e6c05..0918b2c 100644 --- a/_licenses/lgpl-2.1.txt +++ b/_licenses/lgpl-2.1.txt @@ -1,12 +1,11 @@ --- -layout: license title: GNU Lesser General Public License v2.1 nickname: GNU LGPL v2.1 +redirect_from: /licenses/lgpl-v2.1/ +source: http://www.gnu.org/licenses/lgpl-2.1.txt + category: LGPL tab-slug: lgpl-v2_1 -redirect_from: /licenses/lgpl-v2.1/ -permalink: /licenses/lgpl-2.1/ -source: http://www.gnu.org/licenses/lgpl-2.1.txt description: Primarily used for software libraries, LGPL requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. There are two commonly used versions of the LGPL. diff --git a/_licenses/lgpl-3.0.txt b/_licenses/lgpl-3.0.txt index fef3f59..9477cba 100644 --- a/_licenses/lgpl-3.0.txt +++ b/_licenses/lgpl-3.0.txt @@ -1,5 +1,4 @@ --- -layout: license title: GNU Lesser General Public License v3.0 nickname: GNU LGPL v3.0 category: LGPL @@ -7,7 +6,6 @@ tab-slug: lgpl-v3 variant: true redirect_from: /licenses/lgpl-v3/ source: http://www.gnu.org/licenses/lgpl-3.0.txt -permalink: /licenses/lgpl-3.0/ description: Version 3 of the LGPL is an additional set of permissions to the GPL v3 license that requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. diff --git a/_licenses/mit.txt b/_licenses/mit.txt index 234675b..295b59a 100644 --- a/_licenses/mit.txt +++ b/_licenses/mit.txt @@ -1,10 +1,6 @@ --- -layout: license title: MIT License -category: MIT -permalink: /licenses/mit/ source: http://opensource.org/licenses/MIT - featured: true description: A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty. diff --git a/_licenses/mpl-2.0.txt b/_licenses/mpl-2.0.txt index 955d6b9..08e168a 100644 --- a/_licenses/mpl-2.0.txt +++ b/_licenses/mpl-2.0.txt @@ -1,10 +1,7 @@ --- -layout: license title: Mozilla Public License 2.0 -category: Mozilla redirect_from: /licenses/mozilla/ source: http://www.mozilla.org/MPL/2.0/ -permalink: /licenses/mpl-2.0/ description: The Mozilla Public License (MPL 2.0) is maintained by the Mozilla foundation. This license attempts to be a compromise between the permissive BSD license and the reciprocal GPL license. diff --git a/_licenses/no-license.txt b/_licenses/no-license.txt index 7efcf1c..bab802b 100644 --- a/_licenses/no-license.txt +++ b/_licenses/no-license.txt @@ -1,9 +1,6 @@ --- -layout: license -permalink: /licenses/no-license/ -category: No License -class: license-types title: No License +source: "http://choosealicense.com/no-license/" description: You retain all rights and do not permit distribution, reproduction, or derivative works. You may grant some rights in cases where you publish your source code to a site that requires accepting terms of service. For example, publishing code in a public repository on GitHub requires that you allow others to view and fork your code. @@ -25,4 +22,4 @@ forbidden: --- -Copyright [year] [fullname] \ No newline at end of file +Copyright [year] [fullname] diff --git a/_licenses/ofl-1.1.txt b/_licenses/ofl-1.1.txt index a506c7f..e24192e 100644 --- a/_licenses/ofl-1.1.txt +++ b/_licenses/ofl-1.1.txt @@ -1,8 +1,7 @@ --- -layout: license title: SIL Open Font License 1.1 hidden: true -permalink: /licenses/ofl/ +redirect_from: /licenses/ofl/ source: http://scripts.sil.org/OFL_web diff --git a/_licenses/osl-3.0.txt b/_licenses/osl-3.0.txt index 8e9d4ad..64d181f 100644 --- a/_licenses/osl-3.0.txt +++ b/_licenses/osl-3.0.txt @@ -1,9 +1,6 @@ --- title: Open Software License 3.0 -category: OSL 3.0 -layout: license hidden: true -permalink: /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. diff --git a/_licenses/unlicense.txt b/_licenses/unlicense.txt index f0ecae3..addf06c 100644 --- a/_licenses/unlicense.txt +++ b/_licenses/unlicense.txt @@ -1,13 +1,9 @@ --- -layout: license title: The Unlicense +source: http://unlicense.org/UNLICENSE + category: Public Domain Dedication tab-slug: unlicense -permalink: /licenses/unlicense/ -class: license-types -filename: UNLICENSE - -source: http://unlicense.org/UNLICENSE description: Because copyright is automatic in most countries, the Unlicense is a template to waive copyright interest in software you've written and dedicate it to the public domain. Use the Unlicense to opt out of copyright entirely. It also includes the no-warranty statement from the MIT/X11 license. diff --git a/_licenses/wtfpl.txt b/_licenses/wtfpl.txt index ed425f6..6d258ef 100644 --- a/_licenses/wtfpl.txt +++ b/_licenses/wtfpl.txt @@ -1,8 +1,5 @@ --- -layout: license title: "Do What The F*ck You Want To Public License" -category: WTFPL -permalink: /licenses/wtfpl/ hidden: true source: http://www.wtfpl.net/ diff --git a/licenses.html b/licenses.html index 7b23961..e517497 100644 --- a/licenses.html +++ b/licenses.html @@ -9,7 +9,7 @@ title: Licenses {% assign featured_licenses = site.licenses | where:"featured",true %} {% for license in featured_licenses | sort: 'path' %} - {% include license-overview.html %} + {% include license-overview.html license=license %} {% endfor %}

Other licenses

@@ -19,5 +19,5 @@ title: Licenses

{% assign licenses = site.licenses | where:"featured",false | where:"hidden",false | where:"variant",false %} {% for license in licenses %} - {% include license-overview.html %} + {% include license-overview.html license=license %} {% endfor %} diff --git a/script/generate-docs b/script/generate-docs new file mode 100755 index 0000000..bf3b8da --- /dev/null +++ b/script/generate-docs @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +# Usage: script/generate-docs +# Reads in the fields, meta, and rules YAML files and produces markdown output +# suitable for documenting in the project's README + +require 'yaml' + +fields = YAML.load_file("_data/fields.yml") +meta = YAML.load_file("_data/meta.yml") +rules = YAML.load_file("_data/rules.yml") + +puts "\n### Fields\n\n" +fields.each do |field| + puts "* `#{field["name"]}` - #{field["description"]}" +end + +puts "\n### YAML front matter\n" +meta = meta.group_by { |m| m["required"] } + +puts "\n#### Required fields\n\n" +meta[true].each do |meta| + puts "* `#{meta["name"]}` - #{meta["description"]}" +end + +puts "\n#### Optional fields\n\n" +meta[false].each do |meta| + puts "* `#{meta["name"]}` - #{meta["description"]}" +end + +puts "\n### Rules\n" +rules.each do |group, rules| + puts "\n#### #{group.capitalize}\n\n" + rules.each do |rule| + puts "* `#{rule["tag"]}` - #{rule["description"]}" + end +end diff --git a/spec/category_spec.rb b/spec/category_spec.rb new file mode 100644 index 0000000..2e5e9f8 --- /dev/null +++ b/spec/category_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +categories.each do |category| + describe "the #{category} category" do + category_licenses = licenses.select { |l| l["category"] == category } + primary = category_licenses.select { |l| l["variant"] == false } + variants = category_licenses.select { |l| l["variant"] == true } + + it "should only have one primary license" do + expect(primary.count).to eql(1) + end + + it "all other licenses should be variants" do + expected = category_licenses.count - 1 + expect(variants.count).to eql(expected) + end + + category_licenses.each do |license| + describe "the #{license["title"]} license" do + it "should have a unique slug" do + dupes = category_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count + expect(dupes).to eql(1) + end + + it "should have a valid tab-slug" do + expect(license["tab-slug"]).to match(/[a-z0-9_]/) + end + end + end + end +end diff --git a/spec/license_fields_spec.rb b/spec/license_fields_spec.rb new file mode 100644 index 0000000..5ea79d6 --- /dev/null +++ b/spec/license_fields_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +licenses.each do |license| + describe "The #{license["title"]} license" do + it "should only contain supported fields" do + matches = license["content"].scan /\[([a-z]+)\]/ + extra_fields = matches.flatten - fields.map { |f| f["name"] } + expect(extra_fields).to be_empty + end + end +end diff --git a/spec/license_meta_spec.rb b/spec/license_meta_spec.rb new file mode 100644 index 0000000..6635de2 --- /dev/null +++ b/spec/license_meta_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +licenses.each do |license| + + # Manually load the raw license so we don't get thed defaults + raw_fields = SafeYAML.load_file("_licenses/#{license["id"]}.txt") + + describe "The #{license["title"]} license" do + it "should only contain supported meta fields" do + extra_fields = raw_fields.keys - meta.map { |m| m["name"] } + expect(extra_fields).to be_empty + end + + it "should contain all required meta fields" do + required = meta.select { |m| m["required"] }.map { |m| m["name"] } + missing = required - raw_fields.keys + expect(missing).to be_empty + end + + if license["category"] + it "should contain the required license variant fields" do + missing = ["category", "tab-slug"] - license.keys + expect(missing).to be_empty + end + else + it "should not contain license family specific fields" do + extra = ["variant", "category", "tab-slug"].select{ |f| raw_fields.keys.include?(f) } + expect(extra).to be_empty + end + end + end +end diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 25efd5e..88afa6a 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -2,14 +2,6 @@ require 'spec_helper' licenses.each do |license| describe "The #{license["title"]} license" do - it "should have a title" do - expect(license["title"]).to_not be_nil - end - - it "should have a description" do - 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" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 354ff08..ddf381e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,7 +17,11 @@ def config end def licenses - site.collections["licenses"].docs.map { |l| l.data.merge("id" => l.basename(".txt")) } + site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) } +end + +def categories + licenses.map { |l| l["category"] }.compact.uniq end def site @@ -33,6 +37,14 @@ def rules site.data["rules"] end +def fields + site.data["fields"] +end + +def meta + site.data["meta"] +end + def rule?(tag, group) rules[group].any? { |r| r["tag"] == tag } end From ceb1a12158e0301570f7824c0f13af213cee0946 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 15:27:15 -0400 Subject: [PATCH 09/11] rename to license_category --- spec/{category_spec.rb => license_category_spec.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec/{category_spec.rb => license_category_spec.rb} (100%) diff --git a/spec/category_spec.rb b/spec/license_category_spec.rb similarity index 100% rename from spec/category_spec.rb rename to spec/license_category_spec.rb From 26493bff3c1c928f1018aa305834b0b0fc9612cf Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 15:34:28 -0400 Subject: [PATCH 10/11] whitespace --- spec/license_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/license_spec.rb b/spec/license_spec.rb index ade76f2..750a78b 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -7,7 +7,6 @@ LICENSE_WHITELIST = %w[ wtfpl ] - licenses.each do |license| describe "The #{license["title"]} license" do describe "SPDX compliance" do From df0fd9213fde40b4e4bab18b52ab30f310a750b7 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 22 Aug 2015 15:42:12 -0400 Subject: [PATCH 11/11] add rules spec --- _licenses/cc0-1.0.txt | 2 +- spec/license_meta_spec.rb | 2 +- spec/license_rules_spec.rb | 24 ++++++++++++++++++++++++ spec/license_spec.rb | 16 ---------------- 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 spec/license_rules_spec.rb diff --git a/_licenses/cc0-1.0.txt b/_licenses/cc0-1.0.txt index 9bf170a..8a92a85 100644 --- a/_licenses/cc0-1.0.txt +++ b/_licenses/cc0-1.0.txt @@ -20,7 +20,7 @@ permitted: - modifications - distribution - private-use - + forbidden: - no-liability diff --git a/spec/license_meta_spec.rb b/spec/license_meta_spec.rb index 6635de2..796b7eb 100644 --- a/spec/license_meta_spec.rb +++ b/spec/license_meta_spec.rb @@ -16,7 +16,7 @@ licenses.each do |license| missing = required - raw_fields.keys expect(missing).to be_empty end - + if license["category"] it "should contain the required license variant fields" do missing = ["category", "tab-slug"] - license.keys diff --git a/spec/license_rules_spec.rb b/spec/license_rules_spec.rb new file mode 100644 index 0000000..5049bea --- /dev/null +++ b/spec/license_rules_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +licenses.each do |license| + + groups = rules.keys + + describe "The #{license["title"]} license" do + groups.each do |group| + + valid_tags = rules[group].map { |r| r["tag"] } + + describe "the #{group} group" do + it "should exist" do + expect(license[group]).to_not be_nil + end + + it "should only contain valid tags" do + extra = license[group] - valid_tags + expect(extra).to be_empty + end + end + end + end +end diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 750a78b..db20cde 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -31,21 +31,5 @@ licenses.each do |license| end end end - - ["permitted", "required", "forbidden"].each do |group| - describe "#{group} properties" do - it "should list the properties" do - expect(license[group]).to_not be_nil - end - - license[group].to_a.each do |tag| - describe "#{tag} tag" do - it "should be a valid tag" do - expect(rule?(tag,group)).to be(true) - end - end - end - end - end end end