bin/licensee in licensee-8.1.0 vs bin/licensee in licensee-8.2.0

- old
+ new

@@ -1,6 +1,7 @@ #!/usr/bin/env ruby + require_relative '../lib/licensee' path = ARGV[0] || Dir.pwd def print_file(license_file) @@ -11,24 +12,15 @@ end def print_evaluation(file) if file puts "License: #{file.license ? file.license.meta['title'] : 'no license'}" - puts "Confidence: #{file.confidence}%" - puts "Method: #{file.matcher.class}" + puts "Confidence: #{format('%.2f', file.confidence)}%" if file.confidence + puts "Method: #{file.matcher.class}" if file.matcher else puts 'Unknown' end end -if File.file?(path) - contents = File.read(path, encoding: 'utf-8') - license_file = Licensee::Project::LicenseFile.new(contents, path) - print_file(license_file) - print_evaluation(license_file) -else - options = { detect_packages: true, detect_readme: true } - project = Licensee::GitProject.new(path, options) - file = project.matched_file - print_file(project.license_file) - print_evaluation(file) -end +project = Licensee.project(path, detect_packages: true, detect_readme: true) +print_file(project.license_file) +print_evaluation(project.matched_file)