Sha256: 1b6725f93def4e76550b29a986bc8ecf72c463fad36fd266402963fcdbb89578

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require 'veewee/config/component'
require 'veewee/definition'

require 'ostruct'

module Veewee
  class Config
    class Definition

      attr_accessor :components
      attr_reader :env

      def initialize(config)
        @env=config.env
        @components=Hash.new
      end
      
      # Currently not used, this is in case we will specify the a definition in the Veeweefile
      # This is for future needs
      def define(name)
        # Depending on type, we create a variable of that type
        definition_stub=OpenStruct.new

        begin        
        # Get a real definition object
        real_definition=::Veewee::Definition.new(name,env)
        rescue Error => e
          env.ui.error "Error loading provider with #{name},#{$!}"
        end
        
        definition_stub.definition=real_definition

        env.logger.debug("config definition"){ "Start defining definition"}

        yield definition_stub

        env.logger.debug("config definition"){ "End defining definition #{definition_stub.definition.name}"}

        components[name.to_s]=definition_stub.definition
      end

    end
  end
end #Module Veewee

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha6 lib/veewee/config/definition.rb
veewee-0.3.0.alpha5 lib/veewee/config/definition.rb
veewee-0.3.0.alpha4 lib/veewee/config/definition.rb
veewee-0.3.0.alpha3 lib/veewee/config/definition.rb
veewee-0.3.0.alpha2 lib/veewee/config/definition.rb
veewee-0.3.0.alpha1 lib/veewee/config/definition.rb