Skip to content

Commit 3c6df02

Browse files
authored
Merge branch 'gh-pages' into patch-1
2 parents c51d2e9 + 80132f7 commit 3c6df02

6 files changed

Lines changed: 12 additions & 21 deletions

File tree

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ end
1717
group :test do
1818
gem 'html-proofer', '~> 3.0'
1919
gem 'licensee'
20-
gem 'nokogiri'
2120
gem 'rake'
2221
gem 'rspec'
2322
gem 'rubocop'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The licenses on choosealicense.com are regularly imported to GitHub.com to be us
6969
* `project` - The repository name
7070
* `description` - The description of the repository
7171
* `year` - The current year
72-
* `project_url` - The repository URL or other project website
72+
* `projecturl` - The repository URL or other project website
7373

7474
## License properties
7575

_data/fields.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
- name: year
2323
description: The current year
2424

25-
- name: project_url
25+
- name: projecturl
2626
description: The repository URL or other project website

_licenses/ncsa.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Copyright (c) [year] [fullname]. All rights reserved.
3434

3535
Developed by: [project]
3636
[fullname]
37-
[project_url]
37+
[projecturl]
3838

3939
Permission is hereby granted, free of charge, to any person
4040
obtaining a copy of this software and associated documentation files

script/check-approval

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ approvals.each do |approver, licenses|
5252
rows << ["#{approver} approved", licenses.include?(license)]
5353
end
5454

55+
license_ids = licenses.map { |l| l['id'] }
5556
current = license_ids.include?(license)
5657
rows << ['Current license', current]
5758

spec/spec_helper.rb

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
require 'json'
55
require 'licensee'
66
require 'open-uri'
7-
require 'nokogiri'
87

98
module SpecHelper
109
class << self
@@ -86,7 +85,7 @@ def spdx_ids
8685
end
8786

8887
def find_spdx(license)
89-
spdx_list.find { |name, _properties| name == license }
88+
spdx_list.find { |name, _properties| name.casecmp(license).zero? }
9089
end
9190

9291
def osi_approved_licenses
@@ -102,23 +101,15 @@ def osi_approved_licenses
102101

103102
def fsf_approved_licenses
104103
SpecHelper.fsf_approved_licenses ||= begin
105-
url = 'https://www.gnu.org/licenses/license-list.en.html'
106-
doc = Nokogiri::HTML(open(url).read)
107-
list = doc.css('.green dt')
104+
url = 'https://wking.github.io/fsf-api/licenses-full.json'
105+
object = JSON.parse(open(url).read)
108106
licenses = {}
109-
list.each do |license|
110-
a = license.css('a').find { |link| !link.text.nil? && !link.text.empty? && link.attr('id') }
111-
next if a.nil?
112-
id = a.attr('id').downcase
113-
name = a.text.strip
114-
licenses[id] = name
115-
end
116-
117-
# FSF approved the Clear BSD, but doesn't use its SPDX ID or Name
118-
if licenses.keys.include? 'clearbsd'
119-
licenses['bsd-3-clause-clear'] = licenses['clearbsd']
107+
object.each_value do |meta|
108+
next unless (meta.include? 'identifiers') && (meta['identifiers'].include? 'spdx') && (meta.include? 'tags') && (meta['tags'].include? 'libre')
109+
meta['identifiers']['spdx'].each do |identifier|
110+
licenses[identifier.downcase] = meta['name']
111+
end
120112
end
121-
122113
licenses
123114
end
124115
end

0 commit comments

Comments
 (0)