Class: Henry::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/henry/container.rb,
lib/henry/container/version.rb

Overview

Henry Container

Constant Summary collapse

VERSION =

Current Gem version

ENV['gem_version'] || '0.1.82'

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Container

Initialize the Container with the given options

Parameters:

  • the (Hash)

    execution given options.



29
30
31
# File 'lib/henry/container.rb', line 29

def initialize(opts)
  @opts = opts
end

Instance Method Details

#executeObject

Executes the loaded tasks and stores their results.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/henry/container.rb', line 34

def execute
  self.before_execution
  
  enabled_tasks = self.tasks.select {|task| task.enabled?}

  self.alert(:init, :tasks => enabled_tasks, :params => self.params)

  self.params.each_with_index do |params, index|
    tasks_results_set = []
    
    enabled_tasks.each_with_index do |task, task_index|
       self.alert(:task, :index => task_index+enabled_tasks.count*index+1, :total => enabled_tasks.count*self.params.count)
       
       task_params = (params['all'] || {}).merge(params[task.name] || {})

       task.configure(task_params,self.task_extended_context(task_params))
       task.export_params(task_params)
       task.export_config({output_directory:task.data.system[:output_directory]})

       task.before_execute

       self.execute_task(task)

       task.after_execute
       
       tasks_results_set << task.report
    end

    self.tasks_results << tasks_results_set
  end

  self.update_results

  self.alert(:result)

  self.dump_results
end