Sha256: d29ce30f46b5443477c5660131311c572d7408551cc2e5e8e732e4ddfdf018c1
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
require_relative "bives/version" require 'open4' module Bives class ConversionException < Exception end class InitialisationException < Exception end JAR_FILENAME = "BiVeS-1.1.3-SNAPSHOT-fat.jar" JAR_FILEPATH = File.join File.dirname(__FILE__),"jars","#{JAR_FILENAME}" def self.included(mod) unless File.exist?(JAR_FILEPATH) raise InitialisationException.new("Jar file #{JAR_FILEPATH} not found") end end def check_jar unless File.exist?(JAR_FILEPATH) raise InitialisationException.new("Jar file #{JAR_FILEPATH} not found") end end def compare file1,file2,opts=["reportHtml"] check_jar cmd_opts = opts.collect{|o| "--#{o}"}.join(" ") command = "java -jar #{JAR_FILEPATH} #{cmd_opts} #{file1} #{file2}" err_message = "" output = "" status = Open4::popen4(command) do |pid, stdin, stdout, stderr| while ((line = stdout.gets) != nil) do output << line end stdout.close while ((line=stderr.gets)!= nil) do err_message << line end stderr.close end output=output.strip if status.to_i != 0 raise ConversionException.new(err_message) end output end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
bives-0.10 | lib/bives.rb |
bives-0.9 | lib/bives.rb |
bives-0.8 | lib/bives.rb |
bives-0.7 | lib/bives.rb |
bives-0.6 | lib/bives.rb |