Class: Tumugi::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/tumugi/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



13
14
15
16
# File 'lib/tumugi/application.rb', line 13

def initialize
  @tasks = {}
  @params = {}
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



11
12
13
# File 'lib/tumugi/application.rb', line 11

def params
  @params
end

Instance Method Details

#add_task(id, task) ⇒ Object



27
28
29
# File 'lib/tumugi/application.rb', line 27

def add_task(id, task)
  @tasks[id.to_s] = task
end

#execute(command, root_task_id, options) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/tumugi/application.rb', line 18

def execute(command, root_task_id, options)
  process_common_options(options)
  load_workflow_file(options[:file])
  dag = create_dag(root_task_id)
  command_module = Kernel.const_get("Tumugi").const_get("Command")
  cmd = command_module.const_get("#{command.to_s.capitalize}").new
  cmd.execute(dag, options)
end

#find_task(id) ⇒ Object



31
32
33
34
35
# File 'lib/tumugi/application.rb', line 31

def find_task(id)
  task = @tasks[id.to_s]
  raise Tumugi::TumugiError, "Task not found: #{id}" if task.nil?
  task
end