mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
check if license is aleady a license
This commit is contained in:
parent
4013339bfd
commit
e505eb8fb9
@ -50,8 +50,11 @@ approvals.each do |name, licenses|
|
|||||||
rows << ["#{name} approved", licenses.include?(license)]
|
rows << ["#{name} approved", licenses.include?(license)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
current = license_ids.include?(license)
|
||||||
|
rows << ["Current license", current]
|
||||||
|
|
||||||
rows << :separator
|
rows << :separator
|
||||||
eligible = !!(spdx && approved_licenses.include?(license))
|
eligible = !!(!current && spdx && approved_licenses.include?(license))
|
||||||
rows << ["Eligible", eligible]
|
rows << ["Eligible", eligible]
|
||||||
|
|
||||||
puts Terminal::Table.new title: "License: #{license}", rows: rows
|
puts Terminal::Table.new title: "License: #{license}", rows: rows
|
||||||
|
@ -19,7 +19,14 @@ def config
|
|||||||
end
|
end
|
||||||
|
|
||||||
def licenses
|
def licenses
|
||||||
site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) }
|
site.collections["licenses"].docs.map do |license|
|
||||||
|
id = File.basename(license.basename, ".txt")
|
||||||
|
license.to_liquid.merge("id" => id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def license_ids
|
||||||
|
licenses.map { |l| l["id"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def families
|
def families
|
||||||
|
Loading…
x
Reference in New Issue
Block a user