Sha256: e8d3d96ad51c4d694a90af2702629f8236e0ddaa2a647c2f39fab42a39afae5e
Contents?: true
Size: 1.28 KB
Versions: 20
Compression:
Stored size: 1.28 KB
Contents
require 'singleton' require 'tempfile' require 'csv' require 'libis/tools/extend/string' require 'libis/tools/logger' require 'libis/tools/command' require 'libis/format/config' module Libis module Format class Droid include Singleton include ::Libis::Tools::Logger def self.run(file) self.instance.run file end 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 end end end
Version data entries
20 entries across 20 versions & 1 rubygems