File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717group :test do
1818 gem 'html-proofer' , '~> 3.0'
1919 gem 'licensee'
20- gem 'nokogiri'
2120 gem 'rake'
2221 gem 'rspec'
2322 gem 'rubocop'
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ Copyright (c) [year] [fullname]. All rights reserved.
3434
3535Developed by: [project]
3636 [fullname]
37- [project_url ]
37+ [projecturl ]
3838
3939Permission is hereby granted, free of charge, to any person
4040obtaining a copy of this software and associated documentation files
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ approvals.each do |approver, licenses|
5252 rows << [ "#{ approver } approved" , licenses . include? ( license ) ]
5353end
5454
55+ license_ids = licenses . map { |l | l [ 'id' ] }
5556current = license_ids . include? ( license )
5657rows << [ 'Current license' , current ]
5758
Original file line number Diff line number Diff line change 44require 'json'
55require 'licensee'
66require 'open-uri'
7- require 'nokogiri'
87
98module SpecHelper
109 class << self
@@ -86,7 +85,7 @@ def spdx_ids
8685end
8786
8887def find_spdx ( license )
89- spdx_list . find { |name , _properties | name == license }
88+ spdx_list . find { |name , _properties | name . casecmp ( license ) . zero? }
9089end
9190
9291def osi_approved_licenses
@@ -102,23 +101,15 @@ def osi_approved_licenses
102101
103102def 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
124115end
You can’t perform that action at this time.
0 commit comments