This commit is contained in:
Ben Balter 2016-01-18 16:39:03 -05:00
Родитель 8de56f6e6f
Коммит 4013339bfd
3 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -6,6 +6,7 @@ gem "jekyll-seo-tag"
group :development do group :development do
gem 'colored' gem 'colored'
gem 'terminal-table' gem 'terminal-table'
gem 'fuzzy_match'
end end
group :test do group :test do

Просмотреть файл

@ -26,6 +26,7 @@ GEM
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
fast-stemmer (1.0.2) fast-stemmer (1.0.2)
ffi (1.9.10) ffi (1.9.10)
fuzzy_match (2.1.0)
gemoji (2.1.0) gemoji (2.1.0)
github-pages (43) github-pages (43)
RedCloth (= 4.2.9) RedCloth (= 4.2.9)
@ -167,6 +168,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
colored colored
fuzzy_match
github-pages github-pages
html-proofer (= 2.5.2) html-proofer (= 2.5.2)
jekyll-seo-tag jekyll-seo-tag

Просмотреть файл

@ -6,6 +6,7 @@
require_relative '../spec/spec_helper' require_relative '../spec/spec_helper'
require 'terminal-table' require 'terminal-table'
require 'colored' require 'colored'
require 'fuzzy_match'
# Display usage instructions # Display usage instructions
if ARGV.count != 1 if ARGV.count != 1
@ -56,3 +57,14 @@ rows << ["Eligible", eligible]
puts Terminal::Table.new title: "License: #{license}", rows: rows puts Terminal::Table.new title: "License: #{license}", rows: rows
puts puts
puts "Code search: https://github.com/search?q=#{license}+filename%3ALICENSE&type=Code" 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