Sha256: 0d150aed4edf8d231a6facf2fe53bbb5879e0bb0011007be0628da952ff9052b

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'pathname'
require 'yaml'

module LicenseFinder
  ROOT_PATH = Pathname.new(__FILE__).dirname

  class Configuration
    attr_reader :whitelist, :ignore_groups, :dependencies_dir

    def initialize
      config = {}

      if File.exists?('./config/license_finder.yml')
        yaml = File.open('./config/license_finder.yml').readlines.join
        config = YAML.load(yaml)
      end

      @whitelist = config['whitelist'] || []
      @ignore_groups = (config["ignore_groups"] || []).map(&:to_sym)
      @dependencies_dir = config['dependencies_file_dir'] || '.'
    end

    def dependencies_yaml
      File.join(dependencies_dir, "dependencies.yml")
    end

    def dependencies_text
      File.join(dependencies_dir, "dependencies.txt")
    end
  end

  def self.config
    @config ||= Configuration.new
  end
end

require 'license_finder/railtie' if defined?(Rails)
require 'license_finder/finder'
require 'license_finder/gem_spec_details'
require 'license_finder/file_parser'
require 'license_finder/license_file'

require 'license_finder/dependency'
require 'license_finder/dependency_list'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
license_finder-0.4.5 lib/license_finder.rb