Class: Pipely::Actions::GraphLivePipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/actions/graph_live_pipeline.rb

Overview

Graph a deployed pipeline with live execution statuses.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GraphLivePipeline

Returns a new instance of GraphLivePipeline.



8
9
10
# File 'lib/pipely/actions/graph_live_pipeline.rb', line 8

def initialize(options)
  @options = options
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pipely/actions/graph_live_pipeline.rb', line 12

def execute
  live_pipeline = Pipely::LivePipeline.new(@options.pipeline_id)
  live_pipeline.print_runs_report

  outfile = if @options.latest_run
    live_pipeline.render_latest_graph(@options.output_path)
  else
    live_pipeline.render_graphs(@options.output_path)
  end

  if @options.json_output
    $stdout.puts({ :graph => outfile }.to_json)
  elsif $stdout.tty?
    $stdout.puts "Generated #{outfile}"
  else
    $stdout.puts outfile
  end
end