Sha256: 43d2e82e753da83c2ddda157ba83947664ad7b5df91d3bcf7dd511a2a3af5778
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# -*- encoding: utf-8 -*- require 'yaml' module Coco # I know the configuration of coco. # # @example read the threeshold value # config = Configuration.new # config[:threeshold] # => 90 # # You can override the default configuration by putting a '.coco' file # in YAML format in the project root directory. # @example to override the threeshold put this line in a '.coco' file: # :threeshold: 70 # # @note You can set the threeshold above 100% (to be sure to see all files) but you # cannot set it under 0. class Configuration < Hash def initialize self[:threeshold] = 100 self[:directories] = ['lib'] self[:excludes] = [] self[:single_line_report] = false if File.exist?('.coco.yml') self.merge!(YAML.load_file('.coco.yml')) # Deprecated: Support of '.coco' file will be remove in a future # version. elsif File.exist?('.coco') self.merge!(YAML.load_file('.coco')) end expand_directories remove_directories end private def expand_directories self[:excludes].each do |file_or_dir| add_files file_or_dir if File.directory?(file_or_dir) end end def add_files dir Helpers.rb_files_from(dir).each {|file| self[:excludes] << file } end def remove_directories self[:excludes].delete_if {|file_or_dir| File.directory?(file_or_dir)} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coco-0.7 | lib/coco/configuration.rb |