Sha256: 98f6c7f6402a5ba25456a853af013c4d7bbd7b2640136f87eacbd3c455247874

Contents?: true

Size: 1.9 KB

Versions: 7

Compression:

Stored size: 1.9 KB

Contents

require_relative 'licensee/version'
require_relative 'licensee/content_helper'
require_relative 'licensee/license'
require_relative 'licensee/rule'

# Projects
require_relative 'licensee/project'
require_relative 'licensee/projects/git_project'
require_relative 'licensee/projects/fs_project'

# Project files
require_relative 'licensee/project_file'
require_relative 'licensee/project_files/license_file'
require_relative 'licensee/project_files/package_info'
require_relative 'licensee/project_files/readme'

# Matchers
require_relative 'licensee/matchers/exact_matcher'
require_relative 'licensee/matchers/copyright_matcher'
require_relative 'licensee/matchers/dice_matcher'
require_relative 'licensee/matchers/package_matcher'
require_relative 'licensee/matchers/gemspec_matcher'
require_relative 'licensee/matchers/npm_bower_matcher'
require_relative 'licensee/matchers/cran_matcher'
require_relative 'licensee/matchers/dist_zilla_matcher'

module Licensee
  # Over which percent is a match considered a match by default
  CONFIDENCE_THRESHOLD = 95

  # Base domain from which to build license URLs
  DOMAIN = 'http://choosealicense.com'.freeze

  class << self
    attr_writer :confidence_threshold

    # Returns an array of Licensee::License instances
    def licenses(options = {})
      Licensee::License.all(options)
    end

    # Returns the license for a given path
    def license(path)
      Licensee.project(path).license
    end

    def project(path, **args)
      Licensee::GitProject.new(path, args)
    rescue Licensee::GitProject::InvalidRepository
      Licensee::FSProject.new(path, args)
    end

    def confidence_threshold
      @confidence_threshold ||= CONFIDENCE_THRESHOLD
    end

    # Inverse of the confidence threshold, represented as a float
    # By default this will be 0.1
    def inverse_confidence_threshold
      @inverse ||= (1 - Licensee.confidence_threshold / 100.0).round(2)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
licensee-8.9.0 lib/licensee.rb
licensee-8.8.5 lib/licensee.rb
licensee-8.8.4 lib/licensee.rb
licensee-8.8.3 lib/licensee.rb
licensee-8.8.2 lib/licensee.rb
licensee-8.8.1 lib/licensee.rb
licensee-8.8.0 lib/licensee.rb