Module: GitCompound::Task

Extended by:
Task
Included in:
Task
Defined in:
lib/git_compound.rb,
lib/git_compound/task.rb,
lib/git_compound/task/task.rb,
lib/git_compound/task/task_all.rb,
lib/git_compound/task/task_each.rb,
lib/git_compound/task/task_single.rb,
lib/git_compound/logger/debug/task.rb

Overview

Task module and factory

Defined Under Namespace

Classes: Task, TaskAll, TaskEach, TaskSingle

Instance Method Summary collapse

Instance Method Details

#factory(name, type, manifest, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/git_compound/task.rb', line 7

def factory(name, type, manifest, &block)
  case
  # manifest task
  when type.nil? || type == :manfiest then task_class = TaskSingle
  # task for each component defined in manifest
  when type == :each                  then task_class = TaskEach
  # task for all descendant components of manifest
  when type == :all                   then task_class = TaskAll
  else
    raise GitCompoundError, "Unrecognized task type `#{type}`"
  end

  task_class.new(name, manifest, &block)
end