Module: CIAT::Differs::HtmlDiffer

Included in:
Compilers::Java, Executors::Java, Executors::Parrot
Defined in:
lib/ciat/differs/html_differ.rb

Overview

Module for implementing the diff between two files. The output is in HTML table rows with the expected output on the left and the generated on the right.

Instance Method Summary collapse

Instance Method Details

#diff_optionsObject

TODO: it would be nice to have line numbers in the output



12
13
14
15
16
17
# File 'lib/ciat/differs/html_differ.rb', line 12

def diff_options
  "--old-group-format='<tr><td>%df</td><td class=\"red\"><pre>%<</pre></td><td></td><td></td></tr>' " + 
  "--new-group-format='<tr><td></td><td></td><td>%dF</td><td class=\"red\"><pre>%></pre><td></tr>' " +
  "--changed-group-format='<tr class=\"yellow\"><td>%df</td><td><pre>%<</pre></td><td>%dF</td><td><pre>%></pre></td></tr>' " +
  "--unchanged-group-format='<tr class=\"green\"><td>%df</td><td><pre>%=</pre></td><td>%dF</td><td><pre>%=</pre></td></tr>'"
end

#html_diff(expected_file, generated_file, diff_file) ⇒ Object



7
8
9
# File 'lib/ciat/differs/html_differ.rb', line 7

def html_diff(expected_file, generated_file, diff_file)
  system("diff #{diff_options} '#{expected_file}' '#{generated_file}' > '#{diff_file}'")
end