Sha256: 19fc6c37669d3a2749595c0c381e42b4f59f966f98cbe9c3137353475733de5e

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require_relative "licensee/version"
require_relative "licensee/content_helper"
require_relative "licensee/license"
require_relative "licensee/project"
require_relative "licensee/project_file"

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"

class Licensee
  # Over which percent is a match considered a match by default
  CONFIDENCE_THRESHOLD = 90

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

  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)
      begin
        Licensee::GitProject.new(path).license
      rescue Licensee::GitProject::InvalidRepository
        Licensee::FSProject.new(path).license
      end
    end

    def confidence_threshold
      @confidence_threshold ||= CONFIDENCE_THRESHOLD
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licensee-6.0.0 lib/licensee.rb
licensee-6.0.0b1 lib/licensee.rb