1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 04:40:09 +01:00

move meta and fields to yaml

This commit is contained in:
Ben Balter 2015-08-22 15:25:16 -04:00
parent fdbaf19d51
commit 915c08b821
30 changed files with 330 additions and 131 deletions

128
README.md
View File

@ -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. 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 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 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 [ChooseALicense.com](http://www.choosealicense.com "Choose A Licence website") is designed to help people make an informed decision about licenses.
licenses.
# Immediate Goals ## Immediate Goals
* Non-partisan. Our goal is to help you find a license that meets *your* goals. * Non-partisan. Our goal is to help you find a license that meets *your* goals.
* Well designed, but that goes without saying. * Well designed, but that goes without saying.
* The homepage should have just enough to help 99% of folks make a decision. * 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 * For the 1%, the site will contain a list of licenses common to specific communities and situations.
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.
* 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 ```bash
git clone https://github.com/github/choosealicense.com.git git clone https://github.com/github/choosealicense.com.git
@ -32,48 +28,80 @@ script/server
``` ```
Open `http://localhost:4000` in your favorite browser. 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 ### 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:
* `title` - The name of the license #### Required fields
* `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.
The licenses on choosealicense.com are regularly imported to GitHub.com to be * `title` - The SPDX-compliant, human-readable license name
used as the list of licenses available when creating a repository. When we * `source` - The URL to the license source text
create a repository, we will replace certain strings in the license with * `description` - A human-readable description of the license
variables from the repository. These can be used to create accurate copyright * `how` - Instructions on how to implement the license
notices. The available variables are: * `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 #### Optional fields
* `[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
# 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 ### Auto-populated fields
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.
# 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 #### Fields
[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 * `fullname` - The full name or username of the repository owner
is licensed under the [MIT license](http://opensource.org/licenses/mit-license.php). * `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).

23
_data/fields.yml Normal file
View File

@ -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

68
_data/meta.yml Normal file
View File

@ -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

View File

@ -1,8 +1,16 @@
<div class="license-family clearfix"> <div class="license-family clearfix">
<div class="license-family-heading"> <div class="license-family-heading">
<h3 class="license-family-name"> <h3 class="license-family-name">
<a href="{{ license.permalink }}"> <a href="{{ license.url }}">
{% 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 %}
</a> </a>
</h3> </h3>
@ -12,7 +20,7 @@
<div class="license-details"> <div class="license-details">
<div class="license-variations js-license-variations"> <div class="license-variations js-license-variations">
<!-- always show this div, even w/o variations, for proper spacing --> <!-- always show this div, even w/o variations, for proper spacing -->
{% if license.tab-slug %} {% if license.category %}
<ul class="nav-pills js-nav-pills"> <ul class="nav-pills js-nav-pills">
{% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %} {% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %}
{% for variation in variations %} {% for variation in variations %}
@ -27,7 +35,13 @@
</ul> </ul>
{% endif %} {% endif %}
</div> </div>
{% 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 %} {% for variation in variations %}
<div {% if variation.tab-slug %}id="{{ variation.tab-slug }}" {% endif %}class="variation-tab {% if variation.tab-slug %}variation-{{ variation.tab-slug }}{% endif %} js-variation-tab{% if license.tab-slug == variation.tab-slug %} active{% endif %}"> <div {% if variation.tab-slug %}id="{{ variation.tab-slug }}" {% endif %}class="variation-tab {% if variation.tab-slug %}variation-{{ variation.tab-slug }}{% endif %} js-variation-tab{% if license.tab-slug == variation.tab-slug %} active{% endif %}">
<table class="license-rules"> <table class="license-rules">
@ -56,7 +70,7 @@
{% endfor %} {% endfor %}
</tr> </tr>
</table> </table>
<p class="small"><a href="{{ variation.permalink }}">View full {{ variation.title }} license »</a></p> <p class="small"><a href="{{ variation.url }}">View full {{ variation.title }} license »</a></p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -4,8 +4,6 @@ nickname: GNU Affero GPL v3.0
category: GPL category: GPL
tab-slug: agpl-v3 tab-slug: agpl-v3
variant: true variant: true
layout: license
permalink: /licenses/agpl-3.0/
source: http://www.gnu.org/licenses/agpl-3.0.txt source: http://www.gnu.org/licenses/agpl-3.0.txt
redirect_from: /licenses/agpl/ redirect_from: /licenses/agpl/

View File

@ -1,11 +1,8 @@
--- ---
title: Apache License 2.0 title: Apache License 2.0
category: Apache
layout: license
permalink: /licenses/apache-2.0/
redirect_from: /licenses/apache/ redirect_from: /licenses/apache/
featured: true featured: true
nickname: Apache
description: A permissive license that also provides an express grant of patent rights from contributors to users. 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: required:
- include-copyright - include-copyright
- document-changes - document-changes
permitted: permitted:
- commercial-use - commercial-use
- modifications - modifications

View File

@ -1,10 +1,7 @@
--- ---
layout: license
title: Artistic License 2.0 title: Artistic License 2.0
category: Artistic
redirect_from: /licenses/artistic/ redirect_from: /licenses/artistic/
source: http://www.perlfoundation.org/attachment/legal/artistic-2_0.txt 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. 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.

View File

@ -1,12 +1,10 @@
--- ---
layout: license
title: BSD 2-clause "Simplified" License title: BSD 2-clause "Simplified" License
nickname: Simplified BSD nickname: Simplified BSD
category: BSD category: BSD
tab-slug: bsd tab-slug: bsd
variant: true variant: true
redirect_from: /licenses/bsd/ redirect_from: /licenses/bsd/
permalink: /licenses/bsd-2-clause/
description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. Both have very minute differences to the MIT license. description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. Both have very minute differences to the MIT license.

View File

@ -1,11 +1,9 @@
--- ---
layout: license
title: BSD 3-clause "New" or "Revised" License title: BSD 3-clause "New" or "Revised" License
nickname: New BSD nickname: New BSD
category: BSD category: BSD
tab-slug: bsd-3 tab-slug: bsd-3
variant: true variant: true
permalink: /licenses/bsd-3-clause/
description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. 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. description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. 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.

View File

@ -1,13 +1,11 @@
--- ---
layout: license
title: Creative Commons Zero v1.0 Universal title: Creative Commons Zero v1.0 Universal
nickname: CC0 1.0 Universal nickname: CC0 1.0 Universal
category: Public Domain Dedication redirect_from: /licenses/cc0/
tab-slug: cc0 tab-slug: cc0
permalink: /licenses/cc0/ category: Public Domain Dedication
class: license-types
variant: true variant: true
filename: LICENSE
source: http://creativecommons.org/publicdomain/zero/1.0/ source: http://creativecommons.org/publicdomain/zero/1.0/

View File

@ -1,9 +1,6 @@
--- ---
layout: license
title: Eclipse Public License 1.0 title: Eclipse Public License 1.0
category: Eclipse
redirect_from: /licenses/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. 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.

View File

@ -1,14 +1,12 @@
--- ---
title: GNU General Public License v2.0 title: GNU General Public License v2.0
nickname: GNU GPL 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/ redirect_from: /licenses/gpl-v2/
source: http://www.gnu.org/licenses/gpl-2.0.txt 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. 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 featured: true

View File

@ -4,8 +4,6 @@ nickname: GNU GPL v3.0
category: GPL category: GPL
tab-slug: gpl-v3 tab-slug: gpl-v3
variant: true variant: true
layout: license
permalink: /licenses/gpl-3.0/
redirect_from: /licenses/gpl-v3/ redirect_from: /licenses/gpl-v3/
source: http://www.gnu.org/licenses/gpl-3.0.txt source: http://www.gnu.org/licenses/gpl-3.0.txt

View File

@ -1,8 +1,7 @@
--- ---
layout: license
title: ISC License title: ISC License
permalink: /licenses/isc/
source: http://opensource.org/licenses/isc-license source: http://opensource.org/licenses/isc-license
category: BSD category: BSD
tab-slug: isc 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. 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: required:
- include-copyright - include-copyright

View File

@ -1,12 +1,11 @@
--- ---
layout: license
title: GNU Lesser General Public License v2.1 title: GNU Lesser General Public License v2.1
nickname: GNU LGPL 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 category: LGPL
tab-slug: lgpl-v2_1 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. 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.

View File

@ -1,5 +1,4 @@
--- ---
layout: license
title: GNU Lesser General Public License v3.0 title: GNU Lesser General Public License v3.0
nickname: GNU LGPL v3.0 nickname: GNU LGPL v3.0
category: LGPL category: LGPL
@ -7,7 +6,6 @@ tab-slug: lgpl-v3
variant: true variant: true
redirect_from: /licenses/lgpl-v3/ redirect_from: /licenses/lgpl-v3/
source: http://www.gnu.org/licenses/lgpl-3.0.txt 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 <a href="/licenses/GPL-3.0">GPL v3 license</a> that requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. description: Version 3 of the LGPL is an additional set of permissions to the <a href="/licenses/GPL-3.0">GPL v3 license</a> that requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction.

View File

@ -1,10 +1,6 @@
--- ---
layout: license
title: MIT License title: MIT License
category: MIT
permalink: /licenses/mit/
source: http://opensource.org/licenses/MIT source: http://opensource.org/licenses/MIT
featured: true 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. 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.

View File

@ -1,10 +1,7 @@
--- ---
layout: license
title: Mozilla Public License 2.0 title: Mozilla Public License 2.0
category: Mozilla
redirect_from: /licenses/mozilla/ redirect_from: /licenses/mozilla/
source: http://www.mozilla.org/MPL/2.0/ 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. 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.

View File

@ -1,9 +1,6 @@
--- ---
layout: license
permalink: /licenses/no-license/
category: No License
class: license-types
title: No License 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. 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] Copyright [year] [fullname]

View File

@ -1,8 +1,7 @@
--- ---
layout: license
title: SIL Open Font License 1.1 title: SIL Open Font License 1.1
hidden: true hidden: true
permalink: /licenses/ofl/ redirect_from: /licenses/ofl/
source: http://scripts.sil.org/OFL_web source: http://scripts.sil.org/OFL_web

View File

@ -1,9 +1,6 @@
--- ---
title: Open Software License 3.0 title: Open Software License 3.0
category: OSL 3.0
layout: license
hidden: true 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. 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

@ -1,13 +1,9 @@
--- ---
layout: license
title: The Unlicense title: The Unlicense
source: http://unlicense.org/UNLICENSE
category: Public Domain Dedication category: Public Domain Dedication
tab-slug: unlicense tab-slug: unlicense
permalink: /licenses/unlicense/
class: license-types
filename: UNLICENSE
source: http://unlicense.org/UNLICENSE
description: Because copyright is automatic in most countries, <a href="http://unlicense.org">the Unlicense</a> 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. description: Because copyright is automatic in most countries, <a href="http://unlicense.org">the Unlicense</a> 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.

View File

@ -1,8 +1,5 @@
--- ---
layout: license
title: "Do What The F*ck You Want To Public License" title: "Do What The F*ck You Want To Public License"
category: WTFPL
permalink: /licenses/wtfpl/
hidden: true hidden: true
source: http://www.wtfpl.net/ source: http://www.wtfpl.net/

View File

@ -9,7 +9,7 @@ title: Licenses
{% assign featured_licenses = site.licenses | where:"featured",true %} {% assign featured_licenses = site.licenses | where:"featured",true %}
{% for license in featured_licenses | sort: 'path' %} {% for license in featured_licenses | sort: 'path' %}
{% include license-overview.html %} {% include license-overview.html license=license %}
{% endfor %} {% endfor %}
<h2>Other licenses</h2> <h2>Other licenses</h2>
@ -19,5 +19,5 @@ title: Licenses
</p> </p>
{% assign licenses = site.licenses | where:"featured",false | where:"hidden",false | where:"variant",false %} {% assign licenses = site.licenses | where:"featured",false | where:"hidden",false | where:"variant",false %}
{% for license in licenses %} {% for license in licenses %}
{% include license-overview.html %} {% include license-overview.html license=license %}
{% endfor %} {% endfor %}

36
script/generate-docs Executable file
View File

@ -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

31
spec/category_spec.rb Normal file
View File

@ -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

View File

@ -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

32
spec/license_meta_spec.rb Normal file
View File

@ -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

View File

@ -2,14 +2,6 @@ require 'spec_helper'
licenses.each do |license| licenses.each do |license|
describe "The #{license["title"]} license" do 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 describe "SPDX compliance" do
# "No license" isn't really a license, so no need to test # "No license" isn't really a license, so no need to test
unless license["id"] == "no-license" unless license["id"] == "no-license"

View File

@ -17,7 +17,11 @@ def config
end end
def licenses 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 end
def site def site
@ -33,6 +37,14 @@ def rules
site.data["rules"] site.data["rules"]
end end
def fields
site.data["fields"]
end
def meta
site.data["meta"]
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