Sha256: 09dd1430ff7c1f38fc9e8e2af110e82cf4307e7ad509d36d721ce37e50d1eab3
Contents?: true
Size: 932 Bytes
Versions: 26
Compression:
Stored size: 932 Bytes
Contents
require 'fitting/configuration/yaml' require 'fitting/configuration/legacy' require 'yaml' module Fitting class Configuration class << self def craft if one_yaml? one_yaml elsif more_than_one_yaml? more_than_one_yaml else legacy end end def one_yaml? File.file?('.fitting.yml') end def more_than_one_yaml? !Dir['fitting/*.yml'].empty? end def one_yaml yaml = YAML.safe_load(File.read('.fitting.yml')) Fitting::Configuration::Yaml.new(yaml) end def more_than_one_yaml files.map do |file| yaml = YAML.safe_load(File.read(file)) Fitting::Configuration::Yaml.new(yaml, file[8..-5]) end end def legacy Fitting::Configuration::Legacy.new end def files Dir['fitting/*.yml'] end end end end
Version data entries
26 entries across 26 versions & 1 rubygems