Sha256: 978d6213d580fdd46533e3b6838fcf6e984e003cf0c63057eada8ec8823b7219

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

#!/usr/bin/env ruby
require_relative '../lib/licensee'

path = ARGV[0] || Dir.pwd

def print_file(license_file)
  if license_file
    puts "License file: #{license_file.filename}"
    puts "Attribution: #{license_file.attribution}" if license_file.attribution
  end
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}"
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
licensee-8.1.0 bin/licensee