From ba91c766d66a412e4056ae3dbd1999e96c38bd75 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 9 Sep 2015 00:04:34 +0100 Subject: [PATCH 1/2] rename category --> family (fix #288) --- README.md | 2 +- _data/meta.yml | 2 +- _includes/license-overview.html | 12 ++++++------ _licenses/agpl-3.0.txt | 2 +- _licenses/bsd-2-clause.txt | 2 +- _licenses/bsd-3-clause-clear.txt | 2 +- _licenses/bsd-3-clause.txt | 2 +- _licenses/cc0-1.0.txt | 2 +- _licenses/gpl-2.0.txt | 2 +- _licenses/gpl-3.0.txt | 2 +- _licenses/isc.txt | 2 +- _licenses/lgpl-2.1.txt | 2 +- _licenses/lgpl-3.0.txt | 2 +- _licenses/unlicense.txt | 2 +- assets/js/app.coffee | 14 +++++++------- spec/license_category_spec.rb | 16 ++++++++-------- spec/license_meta_spec.rb | 6 +++--- spec/spec_helper.rb | 4 ++-- 18 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index e78057a..4146e60 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Licenses sit in the `/_licenses` folder. The text of the license should be wrapp * `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`) +* `family` - 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 ### Auto-populated fields diff --git a/_data/meta.yml b/_data/meta.yml index 99b1d01..f146cfc 100644 --- a/_data/meta.yml +++ b/_data/meta.yml @@ -59,7 +59,7 @@ description: Whether the license is a variant of a family of licenses (e.g., GPL) required: false -- name: category +- name: family description: If part of a license family, the name of the license family (e.g., `GPL`) required: false diff --git a/_includes/license-overview.html b/_includes/license-overview.html index 8b8c6a1..b03be40 100644 --- a/_includes/license-overview.html +++ b/_includes/license-overview.html @@ -2,8 +2,8 @@

- {% if license.category %} - {{ license.category }} + {% if license.family %} + {{ license.family }} {% else %} {% if license.nickname %} {{ license.nickname }} @@ -20,9 +20,9 @@
- {% if license.category %} - {% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %} + {% if license.family %} + {% assign variations = site.licenses | where:"hidden",false | where:"family",license.family %} {% else %} {% assign variations = site.licenses | where:"title",license.title %} {% endif %} diff --git a/_licenses/agpl-3.0.txt b/_licenses/agpl-3.0.txt index a3004e7..fafca4a 100644 --- a/_licenses/agpl-3.0.txt +++ b/_licenses/agpl-3.0.txt @@ -3,7 +3,7 @@ title: GNU Affero General Public License v3.0 nickname: GNU Affero GPL v3.0 tab-slug: agpl-v3 redirect_from: /licenses/agpl/ -category: GPL +family: GPL variant: true source: http://www.gnu.org/licenses/agpl-3.0.txt diff --git a/_licenses/bsd-2-clause.txt b/_licenses/bsd-2-clause.txt index 1b89446..184b146 100644 --- a/_licenses/bsd-2-clause.txt +++ b/_licenses/bsd-2-clause.txt @@ -3,7 +3,7 @@ title: BSD 2-clause "Simplified" License nickname: Simplified BSD tab-slug: bsd redirect_from: /licenses/bsd/ -category: BSD +family: BSD variant: true source: http://opensource.org/licenses/BSD-2-Clause diff --git a/_licenses/bsd-3-clause-clear.txt b/_licenses/bsd-3-clause-clear.txt index e80ee91..c60faed 100644 --- a/_licenses/bsd-3-clause-clear.txt +++ b/_licenses/bsd-3-clause-clear.txt @@ -3,7 +3,7 @@ title: BSD 3-clause Clear License nickname: Clear BSD hidden: true -category: BSD +family: BSD tab-slug: bsd-3-clear variant: true diff --git a/_licenses/bsd-3-clause.txt b/_licenses/bsd-3-clause.txt index 66a6a15..575852e 100644 --- a/_licenses/bsd-3-clause.txt +++ b/_licenses/bsd-3-clause.txt @@ -2,7 +2,7 @@ title: BSD 3-clause "New" or "Revised" License nickname: New BSD tab-slug: bsd-3 -category: BSD +family: BSD variant: true source: http://opensource.org/licenses/BSD-3-Clause diff --git a/_licenses/cc0-1.0.txt b/_licenses/cc0-1.0.txt index 61d35d1..31a0010 100644 --- a/_licenses/cc0-1.0.txt +++ b/_licenses/cc0-1.0.txt @@ -3,7 +3,7 @@ title: Creative Commons Zero v1.0 Universal nickname: CC0 1.0 Universal tab-slug: cc0 redirect_from: /licenses/cc0/ -category: Public Domain Dedication +family: Public Domain Dedication variant: true source: http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/_licenses/gpl-2.0.txt b/_licenses/gpl-2.0.txt index dd3feed..5e3f5b6 100644 --- a/_licenses/gpl-2.0.txt +++ b/_licenses/gpl-2.0.txt @@ -3,7 +3,7 @@ title: GNU General Public License v2.0 nickname: GNU GPL v2.0 tab-slug: gpl-v2 redirect_from: /licenses/gpl-v2/ -category: GPL +family: GPL featured: true source: http://www.gnu.org/licenses/gpl-2.0.txt diff --git a/_licenses/gpl-3.0.txt b/_licenses/gpl-3.0.txt index efbbfb2..b1d947d 100644 --- a/_licenses/gpl-3.0.txt +++ b/_licenses/gpl-3.0.txt @@ -3,7 +3,7 @@ title: GNU General Public License v3.0 nickname: GNU GPL v3.0 tab-slug: gpl-v3 redirect_from: /licenses/gpl-v3/ -category: GPL +family: GPL variant: true source: http://www.gnu.org/licenses/gpl-3.0.txt diff --git a/_licenses/isc.txt b/_licenses/isc.txt index a73e72e..8d9e812 100644 --- a/_licenses/isc.txt +++ b/_licenses/isc.txt @@ -1,7 +1,7 @@ --- title: ISC License tab-slug: isc -category: BSD +family: BSD source: http://opensource.org/licenses/isc-license description: A permissive license lets people do anything with your code with proper attribution and without warranty. The ISC license is functionally equivalent to the BSD 2-Clause and MIT licenses, removing some language that is no longer necessary. diff --git a/_licenses/lgpl-2.1.txt b/_licenses/lgpl-2.1.txt index f4392e4..304d600 100644 --- a/_licenses/lgpl-2.1.txt +++ b/_licenses/lgpl-2.1.txt @@ -3,7 +3,7 @@ title: GNU Lesser General Public License v2.1 nickname: GNU LGPL v2.1 tab-slug: lgpl-v2_1 redirect_from: /licenses/lgpl-v2.1/ -category: LGPL +family: LGPL 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 ae88790..f9af64c 100644 --- a/_licenses/lgpl-3.0.txt +++ b/_licenses/lgpl-3.0.txt @@ -3,7 +3,7 @@ title: GNU Lesser General Public License v3.0 nickname: GNU LGPL v3.0 tab-slug: lgpl-v3 redirect_from: /licenses/lgpl-v3/ -category: LGPL +family: LGPL variant: true source: http://www.gnu.org/licenses/lgpl-3.0.txt diff --git a/_licenses/unlicense.txt b/_licenses/unlicense.txt index 6f7a128..633ae68 100644 --- a/_licenses/unlicense.txt +++ b/_licenses/unlicense.txt @@ -1,7 +1,7 @@ --- title: The Unlicense tab-slug: unlicense -category: Public Domain Dedication +family: Public Domain Dedication 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/assets/js/app.coffee b/assets/js/app.coffee index 37ec371..9bacd46 100644 --- a/assets/js/app.coffee +++ b/assets/js/app.coffee @@ -29,8 +29,8 @@ class Choosealicense my: "top center" at: "bottom center" - # Annotation categories as defined in `_config.yml` - categories: + # Annotation families as defined in `_config.yml` + families: required: "Required" permitted: "Permitted" forbidden: "Forbidden" @@ -45,20 +45,20 @@ class Choosealicense initTooltips: -> # Dynamically add annotations as title attribute to rule list items - for category, rules of window.annotations + for family, rules of window.annotations for rule in rules - $(".license-rules ul.license-#{category} li.#{rule["tag"]}").attr "title", rule["description"] + $(".license-rules ul.license-#{family} li.#{rule["tag"]}").attr "title", rule["description"] # Init tooltips on all rule list items - for category, label of @categories - $(".license-#{category} li").qtip + for family, label of @families + $(".license-#{family} li").qtip content: text: false title: text: label position: @qtip_position style: - classes: "qtip-shadow qtip-#{category}" + classes: "qtip-shadow qtip-#{family}" false diff --git a/spec/license_category_spec.rb b/spec/license_category_spec.rb index 2e5e9f8..423bb14 100644 --- a/spec/license_category_spec.rb +++ b/spec/license_category_spec.rb @@ -1,24 +1,24 @@ 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 } +families.each do |family| + describe "the #{family} family" do + family_licenses = licenses.select { |l| l["family"] == family } + primary = family_licenses.select { |l| l["variant"] == false } + variants = family_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 + expected = family_licenses.count - 1 expect(variants.count).to eql(expected) end - category_licenses.each do |license| + family_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 + dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count expect(dupes).to eql(1) end diff --git a/spec/license_meta_spec.rb b/spec/license_meta_spec.rb index 796b7eb..3649cc8 100644 --- a/spec/license_meta_spec.rb +++ b/spec/license_meta_spec.rb @@ -17,14 +17,14 @@ licenses.each do |license| expect(missing).to be_empty end - if license["category"] + if license["family"] it "should contain the required license variant fields" do - missing = ["category", "tab-slug"] - license.keys + missing = ["family", "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) } + extra = ["variant", "family", "tab-slug"].select{ |f| raw_fields.keys.include?(f) } expect(extra).to be_empty end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ddf381e..49dd589 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,8 +20,8 @@ def licenses site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) } end -def categories - licenses.map { |l| l["category"] }.compact.uniq +def families + licenses.map { |l| l["family"] }.compact.uniq end def site From a9f9398705631b22afe830034fa3cbccc37e97b1 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 9 Sep 2015 00:24:05 +0100 Subject: [PATCH 2/2] use 'ruletype' in app.coffee for clarity --- assets/js/app.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/js/app.coffee b/assets/js/app.coffee index 9bacd46..4a7e899 100644 --- a/assets/js/app.coffee +++ b/assets/js/app.coffee @@ -29,8 +29,8 @@ class Choosealicense my: "top center" at: "bottom center" - # Annotation families as defined in `_config.yml` - families: + # Annotation rule types as defined in `_config.yml` + ruletypes: required: "Required" permitted: "Permitted" forbidden: "Forbidden" @@ -45,20 +45,20 @@ class Choosealicense initTooltips: -> # Dynamically add annotations as title attribute to rule list items - for family, rules of window.annotations + for ruletype, rules of window.annotations for rule in rules - $(".license-rules ul.license-#{family} li.#{rule["tag"]}").attr "title", rule["description"] + $(".license-rules ul.license-#{ruletype} li.#{rule["tag"]}").attr "title", rule["description"] # Init tooltips on all rule list items - for family, label of @families - $(".license-#{family} li").qtip + for ruletype, label of @ruletypes + $(".license-#{ruletype} li").qtip content: text: false title: text: label position: @qtip_position style: - classes: "qtip-shadow qtip-#{family}" + classes: "qtip-shadow qtip-#{ruletype}" false