Class: Battlestation::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/battlestation/plan.rb

Overview

This represents a complete Battlestation Plan, it may include checks and tasks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}, &block) ⇒ Plan

Create a new plan.

Examples:

Battlestation.plan do
  dependency :mysql do
    executable 'mysql'
  end
end


16
17
18
19
# File 'lib/battlestation/plan.rb', line 16

def initialize(opts = {}, &block)
  @tasks = {}
  instance_eval &block if block_given?
end

Instance Attribute Details

#tasksObject

Tasks to perform



6
7
8
# File 'lib/battlestation/plan.rb', line 6

def tasks
  @tasks
end

Instance Method Details

#task(name, &block) ⇒ Object Also known as: dependency

Adds a new task as a dependency.



22
23
24
# File 'lib/battlestation/plan.rb', line 22

def task(name, &block)
  tasks[name] = Battlestation::Task.new(name, &block)
end