Class: Capistrano::Baptize::PackageDefinition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, parent) ⇒ PackageDefinition

Returns a new instance of PackageDefinition.



43
44
45
46
47
48
49
50
51
# File 'lib/baptize/dsl.rb', line 43

def initialize(name, parent)
  @name = name
  @parent = parent
  @dependencies = []
  @install_block = nil
  @verify_block = nil
  @before_block = nil
  @after_block = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/baptize/dsl.rb', line 57

def method_missing(sym, *args, &block)
  if @parent.respond_to?(sym)
    @parent.send(sym, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#after_blockObject (readonly)

Returns the value of attribute after_block.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def after_block
  @after_block
end

#before_blockObject (readonly)

Returns the value of attribute before_block.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def before_block
  @before_block
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def dependencies
  @dependencies
end

#description(desc = nil) ⇒ Object (readonly) Also known as: desc

Returns the value of attribute description.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def description
  @description
end

#install_blockObject (readonly)

Returns the value of attribute install_block.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def install_block
  @install_block
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def name
  @name
end

#verify_blockObject (readonly)

Returns the value of attribute verify_block.



41
42
43
# File 'lib/baptize/dsl.rb', line 41

def verify_block
  @verify_block
end

Instance Method Details

#after(&block) ⇒ Object



85
86
87
# File 'lib/baptize/dsl.rb', line 85

def after(&block)
  @after_block = block
end

#before(&block) ⇒ Object



81
82
83
# File 'lib/baptize/dsl.rb', line 81

def before(&block)
  @before_block = block
end

#full_nameObject



65
66
67
# File 'lib/baptize/dsl.rb', line 65

def full_name
  "baptize:packages:#{name}"
end

#install(&block) ⇒ Object



89
90
91
# File 'lib/baptize/dsl.rb', line 89

def install(&block)
  @install_block = block
end

#requires(*tasks) ⇒ Object



75
76
77
78
79
# File 'lib/baptize/dsl.rb', line 75

def requires(*tasks)
  Array(tasks).flatten.each do |name|
    @dependencies << "baptize:packages:#{name}"
  end
end

#respond_to?(sym, include_priv = false) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/baptize/dsl.rb', line 53

def respond_to?(sym, include_priv = false)
  super || @parent.respond_to?(sym, include_priv)
end

#verify(&block) ⇒ Object



93
94
95
# File 'lib/baptize/dsl.rb', line 93

def verify(&block)
  @verify_block = block
end