Sha256: 624a831560152733c9a02416240e21313dbd0866d6611f149b1a0af4cd4f4e6a

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

# encoding: UTF-8

module Rivet
  class BaseConfig < OpenState
    attr_reader :name
    attr_accessor :bootstrap

    def self.from_file(dsl_file, load_path='.')
      name = File.basename(dsl_file, '.rb')
      data = Proc.new { eval(File.read(dsl_file)) }
      new(name, load_path, &data)
    end

    def initialize(name, load_path='.', &block)
      super()
      @name = name
      @path = load_path
      @bootstrap = OpenState.new
      instance_eval(&block) if block
    end

    def path(*args)
      if args.size < 1
        @path
      else
        File.join(@path, *args)
      end
    end

    def post(&block)
      return @block if block.nil?
      @block = block
    end

    def normalize_security_groups
      security_groups.sort
    end

    protected

    def import(import_path)
      lambda { eval(File.read(import_path)) }.call
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rivet-3.2.0 lib/rivet/common/base_config.rb