class Humidifier::Reservoir::Config

A container class for the user-specified Reservoir configuration.

Attributes

mappings[R]
stack_path[R]
stack_prefix[RW]

Public Class Methods

new() click to toggle source
# File lib/humidifier/reservoir/config.rb, line 8
def initialize
  @mappings = {}
end

Public Instance Methods

files_for(name) click to toggle source
# File lib/humidifier/reservoir/config.rb, line 12
def files_for(name)
  raise Error, 'You must configure a stack path' if stack_path.nil?
  Dir["#{stack_path}/#{name}/*.yml"]
end
map(type, opts = {}, &block) click to toggle source
# File lib/humidifier/reservoir/config.rb, line 17
def map(type, opts = {}, &block)
  mappings[type.to_sym] = Mapping.new(opts, &block)
end
mapping_for(type) click to toggle source
# File lib/humidifier/reservoir/config.rb, line 21
def mapping_for(type)
  mappings[type.to_sym]
end
stack_path=(stack_path) click to toggle source
# File lib/humidifier/reservoir/config.rb, line 25
def stack_path=(stack_path)
  unless File.exist?(stack_path)
    raise Error, "Invalid filepath: #{stack_path}"
  end
  @stack_path = stack_path
end
stacks() click to toggle source
# File lib/humidifier/reservoir/config.rb, line 32
def stacks
  Dir["#{stack_path}/*"].each_with_object([]) do |name, names|
    names << File.basename(name) if File.directory?(name)
  end
end