mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
add fuzy match
This commit is contained in:
parent
8de56f6e6f
commit
4013339bfd
1
Gemfile
1
Gemfile
@ -6,6 +6,7 @@ gem "jekyll-seo-tag"
|
||||
group :development do
|
||||
gem 'colored'
|
||||
gem 'terminal-table'
|
||||
gem 'fuzzy_match'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
@ -26,6 +26,7 @@ GEM
|
||||
multipart-post (>= 1.2, < 3)
|
||||
fast-stemmer (1.0.2)
|
||||
ffi (1.9.10)
|
||||
fuzzy_match (2.1.0)
|
||||
gemoji (2.1.0)
|
||||
github-pages (43)
|
||||
RedCloth (= 4.2.9)
|
||||
@ -167,6 +168,7 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
colored
|
||||
fuzzy_match
|
||||
github-pages
|
||||
html-proofer (= 2.5.2)
|
||||
jekyll-seo-tag
|
||||
|
@ -6,6 +6,7 @@
|
||||
require_relative '../spec/spec_helper'
|
||||
require 'terminal-table'
|
||||
require 'colored'
|
||||
require 'fuzzy_match'
|
||||
|
||||
# Display usage instructions
|
||||
if ARGV.count != 1
|
||||
@ -56,3 +57,14 @@ rows << ["Eligible", eligible]
|
||||
puts Terminal::Table.new title: "License: #{license}", rows: rows
|
||||
puts
|
||||
puts "Code search: https://github.com/search?q=#{license}+filename%3ALICENSE&type=Code"
|
||||
|
||||
if spdx.nil?
|
||||
puts
|
||||
puts "SPDX ID not found. Some possible matches:"
|
||||
puts
|
||||
|
||||
fm = FuzzyMatch.new(spdx_ids)
|
||||
matches = fm.find_all_with_score(license)
|
||||
matches = matches[0...5].map { |record, _dice, _levin| record }
|
||||
matches.each { |l| puts "* #{l}" }
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user