Loads the defaults config file into the given hash.

 @param [String] file the file to load
 @param [<Class => <String => Object>>] hash the class => path => default value entries
546779
def load_defaults_file(file, hash)
      begin
        config = YAML::load_file(file)
      rescue
        raise MigrationError.new("Could not read defaults file #{file}: " + $!)
      end
      # collect the class => path => value entries
      config.each do |path_s, value|
        next if value.nil_or_empty?
        klass, path = create_attribute_path(path_s)
        hash[klass][path] = value
      end
    end
774846
def parse(settings, logfile = nil)
      settings.each do |key, value|
        if value.is_a?(Hash)
          logfile = Logmsg::LogFile.new(key)
          logfiles[key.to_sym] = logfile
          parse(value, logfile)
          logfile.register
        else
          logfile.public_send("#{key}=", value)
        end
      end
    end
956803
def load_from_file!(file)
      data = Psych.safe_load(File.read(file)) if File.file? file
      data = {} unless data.is_a? Hash
      conf = {}
      conf[:networks]     = Network.deserialize_all data['networks'], conf
      conf[:integrations] = Integration.deserialize_all data['integrations'],
                                                        conf
      conf
    end
478706
def read_config_files(files)
      configuration = clone

      begin
        files.each do |config_file|
          next if config_file.nil? || config_file.empty?
          new_config = read_config_file(config_file)
          configuration = Utils.deep_merge_hashes(configuration, new_config)
        end
      rescue ArgumentError => err
        Bunto.logger.warn "WARNING:", "Error reading configuration. " \
                     "Using defaults (and options)."
        $stderr.puts err
      end

      configuration.fix_common_issues.backwards_compatibilize.add_default_collections
    end
495934
def load_config(file)
      unless File.exist?(file)
        raise FalkorLib::Error, "Unable to find the YAML file '#{file}'"
      end
      loaded = YAML.load_file(file)
      unless loaded.is_a?(Hash)
        raise FalkorLib::Error, "Corrupted or invalid YAML file '#{file}'"
      end
      loaded
    end
652316
def load_yaml
      yaml_config_files = @filenames[:yaml]
      yaml_config_file = nil

      yaml_config_files.each do |file|
        yaml_config_file = Utils.lookup_file file
        unless yaml_config_file.nil?
          config = Utils.load_yaml(yaml_config_file)
          return config.empty? ? @default_config : @default_config.merge(config)
        end
      end

      @default_config # Return default config when can't load config file
    end
13955
def load(self, file):
		
		if isfile(file):
			try:
				config = load_source("config", file)
			except Exception as e:
				raise ExceptionInConfigError(e)
			option_missing = False
			values = {}
			for option in self.options:
				# Make sure all options are avaliable (validators aren't run in this case
				# because there are no values defined)
				if option.name not in dir(config):
					values[option.name] = option.default_value
					option_missing = True
				else:
					# Retrieve the option value
					value = getattr(config, option.name)
					# Make sure validator passes
					if option.validator != None:	
						# If validation doesn't pass
						if not option.validator(value):
							# Resort to default value
							values[option.name] = option.default_value
							if self.validation_failed != None:
								self.validation_failed(option.name, value)
							else:
								raise ValidationError(option.name)
							option_missing = True
						# If validation passes
						else:
							values[option.name] = value
					else:
						values[option.name] = value
				if option_missing:
					self.dump(file)
			return _EditableConfig(values, self.options, file, 
				validation_failed=self.validation_failed, debug=self.debug)
		else:
			error = "'%s' not found" % file
			raise FileNotFoundError(error) if version.startswith("3") else IOError(error)
1149727
def read_config_files(files)
      configuration = clone

      begin
        files.each do |config_file|
          next if config_file.nil? || config_file.empty?

          new_config = read_config_file(config_file)
          configuration = Utils.deep_merge_hashes(configuration, new_config)
        end
      rescue ArgumentError => e
        Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
                     "Using defaults (and options)."
        warn e
      end

      configuration.backwards_compatibilize.add_default_collections
    end
7752
def with_file(name, *args)
      logger.debug "with_file(#{name.inspect}, #{args.inspect})"
      result = args.inject(config_for(name)) { |v, i|
        logger.debug "v = #{v.inspect}, i = #{i.inspect}"
        case v
          when Hash
            v[i.to_s]
          when Array
            i.is_a?(Integer) ? v[i] : nil
          else
            nil
        end
      }
      logger.debug "with_file(#{name.inspect}, #{args.inspect}) => #{result.inspect}"
      result
    end
396159
def default_load_paths
      paths = []

      # Check for Rails config path
      paths << "#{::Rails.root}/config" if rails?

      # Check for defined constants
      paths << CONFIG_ROOT if defined?(CONFIG_ROOT) && Dir.exists?(CONFIG_ROOT)
      paths << CONFIG_PATH if defined?(CONFIG_PATH) && Dir.exists?(CONFIG_PATH)

      # Check for config directory in app root
      config_dir = File.join(app_root, 'config')
      paths << config_dir if Dir.exists?(config_dir)

      paths
    end
1373658
def load
      @config = YAML.load_file(config_path)
      @status.set(errors: Status::INFO_FILE_LOADED)
      if @config == false
        @status.set(errors: Status::ERR_NOT_LOADING_EMPTY_FILE)
      end
    rescue
      @status.set(errors: Status::ERR_CANT_LOAD)
    end
457563
function File(file) {
  this.cache = new Map();
  this.history = [];
  this.pattern = file.pattern;
  this.recurse = file.recurse;
  this.dirname = file.dirname;
  this.segment = file.segment;
  this.path = file.path;
  this.orig = file.path;
}
626656
def init_default(data, file: false, **options)
      @type = :datablock
      @data = Datablock.new(data, file)
      @options = Hamster.hash(options)
    end
1024658
def values_to_hash(values, file)
      @hash = {}
      values.each do |key, value|
        unless KEYS.include?(key)
          fail "Unrecognized key #{key} for #{feature}, #{name} in #{file}"
        end
        case key
        when 'auto_default'
          @auto_default = value ? true : false
        when 'data_format', 'get_data_format', 'set_data_format'
          @hash[key] = value.to_sym
        when 'default_only'
          @default_only = true
          # default_value overrides default_only
          @hash['default_value'] ||= value
        when 'multiple'
          @multiple = boolean_default_true(value)
        when 'kind'
          fail "Unknown 'kind': '#{value}'" unless KINDS.include?(value)
          @kind = value.to_sym
        when 'os_version'
          @os_version = value
        else
          # default_value overrides default_only
          @default_only = false if key == 'default_value'
          @hash[key] = value
        end
      end

      # Inherit general to specific if needed
      if @hash.key?('data_format')
        @hash['get_data_format'] = @hash['data_format'] \
          unless @hash.key?('get_data_format')
        @hash['set_data_format'] = @hash['data_format'] \
          unless @hash.key?('set_data_format')
      end
      if @hash.key?('context')
        @hash['get_context'] = @hash['context'] unless @hash.key?('get_context')
        @hash['set_context'] = @hash['context'] unless @hash.key?('set_context')
      end
      if @hash.key?('value')
        @hash['get_value'] = @hash['value'] unless @hash.key?('get_value')
        @hash['set_value'] = @hash['value'] unless @hash.key?('set_value')
      end

      @hash.delete_if { |key, _| key != 'default_value' } if @default_only
    end
135062
def fetch_config
        Rails.logger.debug "Loading #{@file}::#{@env}" if Object.const_defined?('Rails') && Rails.logger.present?
        YAML::load_file(@file)[@env.to_s]
      end
358570
def load_filter_files(files)
      # collect the class => path => value entries from each defaults file
      hash = {}
      files.enumerate { |file| load_filter_file(file, hash) }
      logger.debug { "The migrator loaded the filters #{hash.qp}." }
      hash
    end
535541
def read_config_file(file)
      @config_hash = YAML.load_file(file)
      @starting_path = File.expand_path(File.split(file).first)
      @config_options = {}
      load_tags
      load_file_exclusions
      load_extension_inclusions
      config_options
    end