Sha256: 508e40dfae3d0aa25ec73a4e16b7d900935661d670771ee0f8d1af5e89f4fc06

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require_relative './coconductor/version'
require 'licensee'

module Coconductor
  autoload :CodeOfConduct, 'coconductor/code_of_conduct'
  autoload :Field,         'coconductor/field'
  autoload :Matchers,      'coconductor/matchers'
  autoload :Projects,      'coconductor/projects'
  autoload :ProjectFiles,  'coconductor/project_files'
  autoload :Vendorer,      'coconductor/vendorer'

  CONFIDENCE_THRESHOLD = 85

  class << self
    attr_writer :confidence_threshold

    def codes_of_conduct
      CodeOfConduct.all
    end

    def code_of_conduct(path)
      Coconductor.project(path).code_of_conduct
    end

    def project(path, **args)
      if %r{\Ahttps://github.com}.match?(path)
        Coconductor::Projects::GitHubProject.new(path, args)
      else
        Coconductor::Projects::GitProject.new(path, args)
      end
    rescue Coconductor::Projects::GitProject::InvalidRepository
      Coconductor::Projects::FSProject.new(path, args)
    end

    def confidence_threshold
      @confidence_threshold ||= CONFIDENCE_THRESHOLD
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coconductor-0.10.0 lib/coconductor.rb