Sha256: a85e64dab66a4715221c746af419acf0f7ddcac8d54633bd7c9cba35e213ea1e
Contents?: true
Size: 872 Bytes
Versions: 1
Compression:
Stored size: 872 Bytes
Contents
module Deliv module Deploy class Config def initialize(environment, filename = nil) @environment = environment load!(filename) verify_environments! end def method_missing(name, *_args, &_block) OpenStruct.new(@config[@environment]).send(name) end private def load!(filename = nil) @filename = filename || Rails.root.join('.deploy.yml') if defined?(Rails) file = File.read(@filename) @config = YAML.safe_load(file).with_indifferent_access end def verify_environments! Deliv::Deploy.remote_environments.each { |environment| verify_environment!(environment) } end def verify_environment!(environment) raise ConfigError, "Missing `#{environment}` from `#{@filename}`" unless @config[environment].present? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deliv-deploy-0.0.1 | lib/deliv/deploy/config.rb |