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

Merge branch 'gh-pages' into patch-1

This commit is contained in:
Mike Linksvayer 2018-01-03 12:05:51 -08:00 committed by GitHub
commit 3c6df021c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 21 deletions

View File

@ -17,7 +17,6 @@ end
group :test do
gem 'html-proofer', '~> 3.0'
gem 'licensee'
gem 'nokogiri'
gem 'rake'
gem 'rspec'
gem 'rubocop'

View File

@ -69,7 +69,7 @@ The licenses on choosealicense.com are regularly imported to GitHub.com to be us
* `project` - The repository name
* `description` - The description of the repository
* `year` - The current year
* `project_url` - The repository URL or other project website
* `projecturl` - The repository URL or other project website
## License properties

View File

@ -22,5 +22,5 @@
- name: year
description: The current year
- name: project_url
- name: projecturl
description: The repository URL or other project website

View File

@ -34,7 +34,7 @@ Copyright (c) [year] [fullname]. All rights reserved.
Developed by: [project]
[fullname]
[project_url]
[projecturl]
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files

View File

@ -52,6 +52,7 @@ approvals.each do |approver, licenses|
rows << ["#{approver} approved", licenses.include?(license)]
end
license_ids = licenses.map { |l| l['id'] }
current = license_ids.include?(license)
rows << ['Current license', current]

View File

@ -4,7 +4,6 @@ require 'jekyll'
require 'json'
require 'licensee'
require 'open-uri'
require 'nokogiri'
module SpecHelper
class << self
@ -86,7 +85,7 @@ def spdx_ids
end
def find_spdx(license)
spdx_list.find { |name, _properties| name == license }
spdx_list.find { |name, _properties| name.casecmp(license).zero? }
end
def osi_approved_licenses
@ -102,23 +101,15 @@ end
def fsf_approved_licenses
SpecHelper.fsf_approved_licenses ||= begin
url = 'https://www.gnu.org/licenses/license-list.en.html'
doc = Nokogiri::HTML(open(url).read)
list = doc.css('.green dt')
url = 'https://wking.github.io/fsf-api/licenses-full.json'
object = JSON.parse(open(url).read)
licenses = {}
list.each do |license|
a = license.css('a').find { |link| !link.text.nil? && !link.text.empty? && link.attr('id') }
next if a.nil?
id = a.attr('id').downcase
name = a.text.strip
licenses[id] = name
object.each_value do |meta|
next unless (meta.include? 'identifiers') && (meta['identifiers'].include? 'spdx') && (meta.include? 'tags') && (meta['tags'].include? 'libre')
meta['identifiers']['spdx'].each do |identifier|
licenses[identifier.downcase] = meta['name']
end
end
# FSF approved the Clear BSD, but doesn't use its SPDX ID or Name
if licenses.keys.include? 'clearbsd'
licenses['bsd-3-clause-clear'] = licenses['clearbsd']
end
licenses
end
end