def initialize config_file
unless File.file?(config_file)
raise Errno::ENOENT,
"Configuration file (#{config_file}) does not exist.\nPlease run `gemnasium install`."
end
@path = config_file
config_hash = DEFAULT_CONFIG.merge(YAML.load(ERB.new(File.read(config_file)).result))
config_hash.each do |k, v|
writer_method = "#{k}="
if respond_to?(writer_method)
v = convert_ignored_paths_to_regexp(v) if k.to_s == 'ignored_paths'
send(writer_method, v)
end
end
raise 'Your configuration file does not contain all mandatory parameters or contain invalid values. Please check the documentation.' unless is_valid?
end