Class: Ea::Cli::Command::Svg

Inherits:
Base
  • Object
show all
Defined in:
lib/ea/cli/command/svg.rb

Overview

ea svg NAME FILE [--output=PATH]

Renders a single diagram from a QEA or XMI file into a standalone SVG using the umldi content (placed element bounds + connector waypoints) captured in Ea::Model::Diagram.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Ea::Cli::Command::Base

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ea/cli/command/svg.rb', line 14

def call
  diagram = find_diagram
  svg = Ea::Svg::Renderer.new(diagram,
                               model_index: document.index_by_id).render

  output_path = resolve_output_path(diagram)
  FileUtils.mkdir_p(File.dirname(output_path))
  File.write(output_path, svg)

  formatter.render([[output_path]], columns: [:written_to])
end