class AppStack::Configuration
configuration from yaml file
Attributes
attrs[RW]
exclude[RW]
export[RW]
import[RW]
render[RW]
render_local[RW]
stack_dir[RW]
sync[RW]
Public Class Methods
new(filename = nil)
click to toggle source
rubocop:disable LineLength
# File lib/app_stack/configuration.rb, line 12 def initialize(filename = nil) # use yaml file to set configuration config = default_config.dup YAML.load(File.open(filename, 'r:utf-8').read).each do |k, v| fail ParseError, "unkown option `#{k}` in #{filename}" unless default_config[k.to_sym] fail ParseError, "'#{k}' must be a #{default_config[k.to_sym].class.to_s}" unless v.is_a?(default_config[k.to_sym].class) config[k.to_sym] = v end if filename config.each { |k, v| send("#{k}=", v) } end
Public Instance Methods
default_config()
click to toggle source
rubocop:enable LineLength
# File lib/app_stack/configuration.rb, line 25 def default_config { import: [], sync: [], render: [], render_local: {}, export: [], exclude: [], attrs: {}, stack_dir: '..' } end