lib/bives.rb in bives-0.2 vs lib/bives.rb in bives-0.3
- old
+ new
@@ -4,19 +4,30 @@
module Bives
class ConversionException < Exception
end
+ class InitialisationException < Exception
+
+ end
+
JAR_FILENAME = "BiVeS-1.1.2-SNAPSHOT-fat.jar"
JAR_FILEPATH = File.join File.dirname(__FILE__),"jars","#{JAR_FILENAME}"
def self.included(mod)
unless File.exist?(JAR_FILEPATH)
- raise "Jar file #{JAR_FILEPATH} not found"
+ 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 = ""