Module: Archimate::Cli

Defined in:
lib/archimate.rb,
lib/archimate/cli/lint.rb,
lib/archimate/cli/archi.rb,
lib/archimate/cli/duper.rb,
lib/archimate/cli/stats.rb,
lib/archimate/cli/svger.rb,
lib/archimate/cli/mapper.rb,
lib/archimate/cli/cleanup.rb,
lib/archimate/cli/convert.rb

Defined Under Namespace

Classes: Archi, Cleanup, Convert, Duper, Lint, Mapper, Stats, Svger

Constant Summary collapse

SVG_NAME_OPTION =

TODO: add a way to export in folders with :folder_name]

%i[id name].freeze
DEFAULT_OPTIONS =
{
  svg_name: :id,
  format_xml: true,
  legend: false
}.freeze

Class Method Summary collapse

Class Method Details

.output_io(output_io, force) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/archimate/cli/archi.rb', line 7

def self.output_io(output_io, force)
  if output_io.is_a?(String)
    if !force && File.exist?(output_io)
      # TODO: This needs to be handled with more grace
      cli = HighLine.new
      return nil unless cli.agree("File #{output_io} exists. Overwrite?")
    end
    output_io = File.open(output_io, "w")
  end
  output_io
end

.process_svg_filename(name) ⇒ Object



68
69
70
71
72
# File 'lib/archimate/cli/svger.rb', line 68

def self.process_svg_filename(name)
  file_name = name.strip.tr("/", "-")
  file_name += ".svg" unless file_name =~ /\.svg$/
  file_name
end