20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/libis/format/droid.rb', line 20
def run(file)
profile = File.join Dir.tmpdir, Dir::Tmpname.make_tmpname(%w'droid .profile', nil)
report = File.join Dir.tmpdir, Dir::Tmpname.make_tmpname(%w'droid .csv', nil)
result = Libis::Tools::Command.run(
Libis::Format::Config[:droid_path],
'-a', file.escape_for_string,
'-p', profile,
'-q',
)
warn "DROID profile errors: #{result[:err].join("\n")}" unless result[:status] == 0
result = Libis::Tools::Command.run(
Libis::Format::Config[:droid_path],
'-e', report,
'-p', profile,
'-q'
)
warn "DROID report errors: #{result[:err].join("\n")}" unless result[:status] == 0
File.delete profile
result = CSV.read(report , headers: true, header_converters: [:downcase, :symbol])
File.delete report
result.map{|r|r.to_hash}
end
|