Module: Licensee

Defined in:
lib/licensee/projects/fs_project.rb,
lib/licensee.rb,
lib/licensee/rule.rb,
lib/licensee/license.rb,
lib/licensee/project.rb,
lib/licensee/version.rb,
lib/licensee/project_file.rb,
lib/licensee/content_helper.rb,
lib/licensee/project_files/readme.rb,
lib/licensee/projects/git_project.rb,
lib/licensee/matchers/cran_matcher.rb,
lib/licensee/matchers/dice_matcher.rb,
lib/licensee/matchers/exact_matcher.rb,
lib/licensee/matchers/gemspec_matcher.rb,
lib/licensee/matchers/package_matcher.rb,
lib/licensee/matchers/copyright_matcher.rb,
lib/licensee/matchers/npm_bower_matcher.rb,
lib/licensee/project_files/license_file.rb,
lib/licensee/project_files/package_info.rb,
lib/licensee/matchers/dist_zilla_matcher.rb

Overview

Git-based project

Analyze a given (bare) Git repository for license information

Defined Under Namespace

Modules: ContentHelper, Matchers Classes: FSProject, GitProject, InvalidLicense, License, Project, Rule

Constant Summary collapse

CONFIDENCE_THRESHOLD =

Over which percent is a match considered a match by default

95
DOMAIN =

Base domain from which to build license URLs

'http://choosealicense.com'.freeze
VERSION =
'8.8.1'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.confidence_thresholdObject



53
54
55
# File 'lib/licensee.rb', line 53

def confidence_threshold
  @confidence_threshold ||= CONFIDENCE_THRESHOLD
end

Class Method Details

.inverse_confidence_thresholdObject

Inverse of the confidence threshold, represented as a float By default this will be 0.1



59
60
61
# File 'lib/licensee.rb', line 59

def inverse_confidence_threshold
  @inverse ||= (1 - Licensee.confidence_threshold / 100.0).round(2)
end

.license(path) ⇒ Object

Returns the license for a given path



43
44
45
# File 'lib/licensee.rb', line 43

def license(path)
  Licensee.project(path).license
end

.licenses(options = {}) ⇒ Object

Returns an array of Licensee::License instances



38
39
40
# File 'lib/licensee.rb', line 38

def licenses(options = {})
  Licensee::License.all(options)
end

.project(path, **args) ⇒ Object



47
48
49
50
51
# File 'lib/licensee.rb', line 47

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