Sha256: 4759011dfd5cfbd33896151bd2abc41d9b23c346fc509a46eb9da591e94aa2a2

Contents?: true

Size: 951 Bytes

Versions: 3

Compression:

Stored size: 951 Bytes

Contents

require 'coconductor/version'
require 'licensee'

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

  CONFIDENCE_THRESHOLD = 90

  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 path =~ %r{\Ahttps://github.com}
        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

3 entries across 3 versions & 1 rubygems

Version Path
coconductor-0.4.0 lib/coconductor.rb
coconductor-0.3.1 lib/coconductor.rb
coconductor-0.3.0 lib/coconductor.rb