Class: Suma::Cli::ConvertJsdai

Inherits:
Thor
  • Object
show all
Defined in:
lib/suma/cli/convert_jsdai.rb

Overview

ConvertJsdai command to convert JSDAI XML and image to SVG and EXP

Instance Method Summary collapse

Instance Method Details

#convert_jsdai(xml_file, image_file, output_dir) ⇒ Object

rubocop:disable Metrics/MethodLength



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/suma/cli/convert_jsdai.rb', line 16

def convert_jsdai(xml_file, image_file, output_dir)
  xml_file = File.expand_path(xml_file)
  image_file = File.expand_path(image_file)
  output_dir = File.expand_path(output_dir)

  unless File.exist?(xml_file)
    raise Errno::ENOENT, "XML file not found: #{xml_file}"
  end

  unless File.exist?(image_file)
    raise Errno::ENOENT, "Image file not found: #{image_file}"
  end

  unless File.file?(xml_file)
    raise ArgumentError, "Specified path is not a file: #{xml_file}"
  end

  unless File.file?(image_file)
    raise ArgumentError, "Specified path is not a file: #{image_file}"
  end

  run(xml_file, image_file, output_dir)
end