spec/support/incompatibilities_generator.rb in faml-0.2.15 vs spec/support/incompatibilities_generator.rb in faml-0.2.16
- old
+ new
@@ -22,10 +22,14 @@
else
{ 'Faml' => faml_result, 'Haml, Hamlit' => haml_result }
end
end
+ def only_hamlit?
+ faml_result == haml_result && faml_result != hamlit_result
+ end
+
private
def all_error?
[faml_result, haml_result, hamlit_result].all? { |r| r.is_a?(Exception) }
end
@@ -57,11 +61,11 @@
incompatibilities[spec_path].sort_by(&:line_number).each do |record|
render_difference(f, path, record)
end
end
end
- render_toc(markdown_root, incompatibilities.keys)
+ render_toc(markdown_root, incompatibilities)
end
private
def render_haml(template, options)
@@ -123,22 +127,27 @@
def markdown_path(markdown_root, spec_path)
markdown_root.join(spec_path).sub_ext('.md')
end
- def render_toc(markdown_root, spec_paths)
+ def render_toc(markdown_root, incompatibilities)
toc_path = markdown_root.join('README.md')
toc_path.open('w') do |f|
f.puts '# Incompatibilities'
f.puts '## Versions'
f.puts "- Haml #{Haml::VERSION}"
f.puts "- Faml #{Faml::VERSION}"
f.puts "- Hamlit #{Hamlit::VERSION}"
f.puts
f.puts '## Table of contents'
- spec_paths.sort.each do |spec_path|
+ incompatibilities.keys.sort.each do |spec_path|
path = markdown_path(markdown_root, spec_path).relative_path_from(markdown_root)
- f.puts "- [#{path}](#{path})"
+ link = "[#{path}](#{path})"
+ comment =
+ if incompatibilities[spec_path].all?(&:only_hamlit?)
+ " (Hamlit's incompatibility)"
+ end
+ f.puts "- #{link}#{comment}"
end
end
end
end