Class: JiraDependencyVisualizer::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/jira_dependency_visualizer/graph.rb

Overview

Gets Jira issue dependencies and creates a Graphviz graph based on those dependencies

Instance Method Summary collapse

Constructor Details

#initialize(start_issue_key, jira, excludes = [], colors = {}, graph = nil) ⇒ Graph

Returns a new instance of Graph.

Parameters:

  • the (String)

    initial issue to build the dependency graph from

  • (JiraDependencyVisualizer::Jira)
  • list (Array)

    of issue link types to exclude from the graph

  • colors (Hash) (defaults to: {})

    for graph; see ‘./config/colors.yaml`

  • (Graphviz)


14
15
16
17
18
19
20
21
# File 'lib/jira_dependency_visualizer/graph.rb', line 14

def initialize(start_issue_key, jira, excludes = [], colors = {}, graph = nil)
  @start_issue_key = start_issue_key
  @jira = jira
  @excludes = excludes
  @colors = colors
  @graph = graph || GraphViz.new(start_issue_key.to_sym, type: :digraph)
  @seen = []
end

Instance Method Details

#walkObject

Retrieve a list of all tickets dependent to ‘@start_issue_key` and add them to a Graphviz graph.



25
26
27
# File 'lib/jira_dependency_visualizer/graph.rb', line 25

def walk
  issue_walker(@start_issue_key)
end

#write_graph(filename = './issue_graph.svg', format = 'svg') ⇒ Object

Parameters:

  • filename (String) (defaults to: './issue_graph.svg')

    the output filename

  • format (String) (defaults to: 'svg')

    the graphviz output format for the graph



31
32
33
# File 'lib/jira_dependency_visualizer/graph.rb', line 31

def write_graph(filename = './issue_graph.svg', format = 'svg')
  @graph.output(format.to_sym => filename)
end