Sha256: 9c9281845220224e3c0ee640581592166720639ea64d8c762eb0abb60e05196f
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 KB
Contents
module Percheron class Stack extend Forwardable def_delegators :stack_config, :name, :description def initialize(config, stack_name) @config = config @stack_name = stack_name valid? self end def self.all(config) all = {} config.stacks.each do |stack_name, _| stack = new(config, stack_name) all[stack.name] = stack end all end def container_configs stack_config.containers.inject({}) do |all, container| all[container.name] = container unless all[container.name] all end end def containers containers = {} stack_config.containers.each do |container| container = Container::Main.new(config, self, container.name) containers[container.name] = container end containers end def stop! exec_on_containers { |container| container.stop! } end def start! exec_on_containers { |container| container.start! } end def valid? Validators::Stack.new(self).valid? end private attr_reader :config, :stack_name def stack_config @stack_config ||= config.stacks[stack_name] || Hashie::Mash.new({}) end def exec_on_containers containers.each do |container_name, container| yield(container) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems