Class: Gush::CLI::Overview

Inherits:
Object
  • Object
show all
Defined in:
lib/gush/cli/overview.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow) ⇒ Overview

Returns a new instance of Overview.



6
7
8
# File 'lib/gush/cli/overview.rb', line 6

def initialize(workflow)
  @workflow = workflow
end

Instance Attribute Details

#workflowObject (readonly)

Returns the value of attribute workflow.



4
5
6
# File 'lib/gush/cli/overview.rb', line 4

def workflow
  @workflow
end

Instance Method Details

#jobs_list(jobs) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/gush/cli/overview.rb', line 28

def jobs_list(jobs)
  "\nJobs list:\n".tap do |output|
    jobs_by_type(jobs).each do |job|
      output << job_to_list_element(job)
    end
  end
end

#statusObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gush/cli/overview.rb', line 14

def status
  if workflow.failed?
    failed_status
  elsif workflow.running?
    running_status
  elsif workflow.finished?
    "done".green
  elsif workflow.stopped?
    "stopped".red
  else
    "ready to start".blue
  end
end

#tableObject



10
11
12
# File 'lib/gush/cli/overview.rb', line 10

def table
  Terminal::Table.new(rows: rows)
end