Sha256: 5a49a4f0247fd73ec8e4ad09a36394f4c87c7375b076bedc32e11b02266bf5af

Contents?: true

Size: 787 Bytes

Versions: 7

Compression:

Stored size: 787 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 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

7 entries across 7 versions & 1 rubygems

Version Path
rivet-3.1.0 lib/rivet/common/base_config.rb
rivet-3.0.5 lib/rivet/common/base_config.rb
rivet-3.0.4 lib/rivet/common/base_config.rb
rivet-3.0.3 lib/rivet/common/base_config.rb
rivet-3.0.2 lib/rivet/common/base_config.rb
rivet-3.0.1 lib/rivet/common/base_config.rb
rivet-3.0.0 lib/rivet/common/base_config.rb