lib/licensee.rb in licensee-8.9.2 vs lib/licensee.rb in licensee-9.0.0.beta.1
- old
+ new
@@ -1,34 +1,20 @@
require_relative 'licensee/version'
-require_relative 'licensee/content_helper'
-require_relative 'licensee/license'
-require_relative 'licensee/rule'
+require 'forwardable'
+require 'pathname'
+require 'rugged'
-# 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
+ autoload :ContentHelper, 'licensee/content_helper'
+ autoload :License, 'licensee/license'
+ autoload :Rule, 'licensee/rule'
+ autoload :Matchers, 'licensee/matchers'
+ autoload :Projects, 'licensee/projects'
+ autoload :ProjectFiles, 'licensee/project_files'
+
# Over which percent is a match considered a match by default
- CONFIDENCE_THRESHOLD = 95
+ CONFIDENCE_THRESHOLD = 98
# Base domain from which to build license URLs
DOMAIN = 'http://choosealicense.com'.freeze
class << self
@@ -43,12 +29,12 @@
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)
+ Licensee::Projects::GitProject.new(path, args)
+ rescue Licensee::Projects::GitProject::InvalidRepository
+ Licensee::Projects::FSProject.new(path, args)
end
def confidence_threshold
@confidence_threshold ||= CONFIDENCE_THRESHOLD
end