Class: Cany::Specification::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/cany/specification/dsl.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specification) ⇒ DSL

Returns a new instance of DSL.



4
5
6
# File 'lib/cany/specification/dsl.rb', line 4

def initialize(specification)
  @specification = specification
end

Class Method Details

.delegate(*methods) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/cany/specification/dsl.rb', line 12

def self.delegate(*methods)
  methods.each do |method|
    module_eval(<<-EOS, __FILE__, __LINE__)
      def #{method}(*args, &block)
        @specification.send :'#{method}=', *args, &block
      end
      EOS
  end
end

Instance Method Details

#binary(&block) ⇒ Object



34
35
36
# File 'lib/cany/specification/dsl.rb', line 34

def binary(&block)
  @specification.binary = block
end

#build(&block) ⇒ Object



30
31
32
# File 'lib/cany/specification/dsl.rb', line 30

def build(&block)
  @specification.build = block
end

#exec(&block) ⇒ Object



8
9
10
# File 'lib/cany/specification/dsl.rb', line 8

def exec(&block)
  instance_eval &block
end

#use(name) ⇒ Object

This include the given recipe into the build process.

Parameters:

  • name (Symbol)

    The name of the recipe as symbol.



26
27
28
# File 'lib/cany/specification/dsl.rb', line 26

def use(name)
  @specification.recipes << name
end