Sha256: 61a44e062adc307a8686665581b07798a134678109c9e2d41dac0fb8b606459b
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'daisydiff/version' require 'daisydiff/result' require 'tempfile' require 'terrapin' module DaisyDiff def self.strings(html_1, html_2) begin file_1 = create_tempfile('html_1', html_1) file_2 = create_tempfile('html_2', html_2) output_file = create_tempfile('html_diff') line = Terrapin::CommandLine.new("java", "-jar :jar_path :file_1_path :file_2_path --file=:output_file_path") # puts line.command line.run(:jar_path => File.expand_path(File.dirname(__FILE__) + '/daisydiff/daisydiff.jar'), :file_1_path => file_1.path, :file_2_path => file_2.path, :output_file_path => output_file.path) results = output_file.read # rescue #handle the error here? ensure close_tempfile file_1 close_tempfile file_2 close_tempfile output_file end end protected def self.create_tempfile(filename, contents=nil) tempfile = Tempfile.new(filename) unless contents.nil? tempfile.write(contents) tempfile.flush end tempfile end def self.close_tempfile(tempfile) unless tempfile.nil? tempfile.close tempfile.unlink end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
daisydiff-0.0.2 | lib/daisydiff.rb |