Class: Asciidoctor::Diagram::UmletConverter

Inherits:
Object
  • Object
show all
Includes:
CliGenerator, DiagramConverter
Defined in:
lib/asciidoctor-diagram/umlet/converter.rb

Instance Method Summary collapse

Methods included from CliGenerator

#generate_file, #generate_file_stdout, #generate_stdin, #generate_stdin_file, #generate_stdin_stdout

Methods included from DiagramConverter

#collect_options, #native_scaling?, #wrap_source

Instance Method Details

#convert(source, format, options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/asciidoctor-diagram/umlet/converter.rb', line 18

def convert(source, format, options)
  java = ::Asciidoctor::Diagram::Java.java

  umlet = source.find_command('umlet')
  ext = File.extname(umlet)
  if ext == '' || ext != '.jar'
    umlet = File.expand_path(File.basename(umlet, '.*') + '.jar', File.dirname(umlet))
  end

  generate_file(java, 'uxf', format.to_s, source.to_s) do |tool_path, input_path, output_path|
    {
      :args => [tool_path, '-jar', Platform.native_path(umlet), '-action=convert', "-format=#{format.to_s}", "-filename=#{Platform.native_path(input_path)}", "-output=#{Platform.native_path(output_path)}"],
      :chdir => source.base_dir
    }
  end
end

#supported_formatsObject



14
15
16
# File 'lib/asciidoctor-diagram/umlet/converter.rb', line 14

def supported_formats
  [:svg, :png, :pdf, :gif]
end