11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rabbit/parser/ext/blockdiag.rb', line 11
def make_image(path, prop, logger)
image_file = Tempfile.new("rabbit-image-blockdiag")
command = [
"blockdiag",
"-T", "svg",
"-o", image_file.path,
]
font = find_font(prop)
command.concat(["-f", font]) if font
AVAILABLE_FLAG_OPTIONS.each do |name|
command << "--#{name}" if /\A(?:true|yes)\z/i =~ prop[name].to_s
end
AVAILABLE_VALUE_OPTIONS.each do |name|
command.concat(["--#{name}", prop[name]]) if prop.has_key?(name)
end
command << path
if SystemRunner.run(*command)
image_file
else
format = _("tried blockdiag command: %s")
additional_info = format % command.inspect
raise BlockDiagCanNotHandleError.new(command.join(' '),
additional_info)
end
end
|