Sha256: 59773a14e68568007350a2a581798b99d2fcf31325b4b79e4d348fc89b789797
Contents?: true
Size: 961 Bytes
Versions: 3
Compression:
Stored size: 961 Bytes
Contents
require 'yaml' module SimpleProvision class Configuration MissingServerType = Class.new(StandardError) MissingServerConfiguration = Class.new(StandardError) attr_reader :options attr_reader :profile def initialize(profile) @profile = profile read_and_parse_server_options end private def default_options begin YAML.load(File.read('servers/defaults.yml')) rescue Errno::ENOENT {} end end def server_options begin YAML.load(File.read(server_file)) rescue Errno::ENOENT raise MissingServerConfiguration, "Please create a configuration file './servers/#{profile}.yml'" end end def server_file "servers/#{profile}.yml" end def read_and_parse_server_options options_string_hash = default_options.merge(server_options) @options = Hash[options_string_hash.map{ |(k,v)| [k.to_sym, v] }] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_provision-0.99.8 | lib/simple_provision/configuration.rb |
simple_provision-0.99.7 | lib/simple_provision/configuration.rb |
simple_provision-0.99.6 | lib/simple_provision/configuration.rb |