class DTK::Client::TaskStatus::StreamMode::Element::HierarchicalTask::Results::Action
Constants
- RenderActionLineOpts
Attributes
action_results[R]
Public Class Methods
new(element, hash)
click to toggle source
Calls superclass method
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 21 def initialize(element, hash) super @action_results = hash['action_results'] || [] end
Public Instance Methods
render()
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 38 def render not_first_time = nil render_node_term @action_results.each do |action_result| render_action_result_lines(action_result, :first_time => not_first_time.nil?) not_first_time ||= true end render_empty_line end
render_results(results_per_node)
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 28 def render_results(results_per_node) if any_results?(results_per_node) render_line 'RESULTS:' render_empty_line results_per_node.each { |result| result.render } else render_errors(results_per_node) end end
Private Instance Methods
any_results?(results_per_node)
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 50 def any_results?(results_per_node) !!results_per_node.find { |results| !results.action_results.empty? } end
command?(action_result)
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 81 def command?(action_result) if command = action_result['description'] if match = command.match(/^(create )(.*)/) "ADD: #{match[2]}" else "RUN: #{command}" end end end
render_action_output(line)
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 76 def render_action_output(line) render_line line, RenderActionLineOpts end
render_action_result_lines(action_result, opts = {})
click to toggle source
# File lib/task_status/stream_mode/element/hierarchical_task/result/action.rb, line 54 def render_action_result_lines(action_result, opts = {}) stdout = action_result['stdout'] stderr = action_result['stderr'] unless opts[:first_time] render_line '--' end if command = command?(action_result) render_line command end if return_code = action_result['status'] render_line "RETURN CODE: #{return_code.to_s}" end if stdout && !stdout.empty? render_line 'STDOUT:' render_action_output stdout end if stderr && !stderr.empty? render_line 'STDERR:' render_action_output stderr end end