Sha256: 2c9706d9068461c9d7a37a01e1327ad01ad1518c8717fbc38eb0391a71bfca0d

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

module Divvy
  class Package
    
    def initialize(name, options = {}, &block)
      # raise ArgumentError.new('Name is required') unless name
      @name = name.to_sym
      @options = options
      @dependencies = []
      @verifications = []
      self.instance_eval(&block)
    end

    attr_reader :name, :options, :verifications, :apply_block

    def requires(*packages)
      @dependencies << packages
      @dependencies.flatten!
    end
    
    def dependencies
      @dependencies.each { |package| raise "Package #{package} not found!" unless Divvy.packages.key?(package) }
      @dependencies.map { |key| Divvy.packages[key] }
    end

    def apply(&block)
      @apply_block = block
    end
    
    def verify(description = '', &block)
      @verifications << Verification.new(self, description, &block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
michaeldwan-divvy-0.1.2 lib/divvy/package.rb
michaeldwan-divvy-0.1.5 lib/divvy/package.rb