Sha256: 9a78fadebde4d97df07cdd4f9e34261ee9ad71ef57192cd09863eb4d737bce77

Contents?: true

Size: 633 Bytes

Versions: 7

Compression:

Stored size: 633 Bytes

Contents

require 'yaml'

module Percheron
  class Config

    extend Forwardable

    def_delegators :contents, :docker

    def initialize(file)
      @file = Pathname.new(file).expand_path
      valid?
      docker_setup!
      self
    end

    def stacks
      contents.stacks.to_hash_by_key(:name)
    end

    def file_base_path
      file.dirname
    end

    def valid?
      Validators::Config.new(file).valid?
    end

    private

      attr_reader :file

      def contents
        Hashie::Mash.new(YAML.load_file(file))
      end

      def docker_setup!
        Percheron::DockerConnection.new(self).setup!
      end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
percheron-0.6.4 lib/percheron/config.rb
percheron-0.6.3 lib/percheron/config.rb
percheron-0.6.2 lib/percheron/config.rb
percheron-0.6.1 lib/percheron/config.rb
percheron-0.6.0 lib/percheron/config.rb
percheron-0.5.0 lib/percheron/config.rb
percheron-0.4.0 lib/percheron/config.rb