Module: LicenseScout::Config

Extended by:
Mixlib::Config
Defined in:
lib/license_scout/config.rb

Class Method Summary collapse

Class Method Details

.validate!Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/license_scout/config.rb', line 78

def validate!
  if !allowed_licenses.empty? && !flagged_licenses.empty?
    raise LicenseScout::Exceptions::ConfigError.new("You may specify a list of licenses to allow or flag. You may not specify both.")
  end

  if (allowed_licenses.empty? && flagged_licenses.empty?) && dependency_exceptions?
    LicenseScout::Log.warn("You have specified one or more dependency exceptions, but no allowed or flagged licenses. License Scout will ignore the depdendency exceptions.")
  end

  directories.each do |dir|
    unless File.directory?(File.expand_path(dir))
      raise LicenseScout::Exceptions::ConfigError.new("The '#{dir}' directory could not be found.")
    end
  end
end