Commit d9c055bb authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix bin/compare script.

Make it work with renamed Json class.

Print also those classes that are exactly the same.
parent 1538ab28
Loading
Loading
Loading
Loading
+28 −29
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ $:.unshift File.dirname(File.dirname(__FILE__)) + "/lib"
require "rubygems"
require "cgi"
require "optparse"
require "jsduck/json_duck"
require "jsduck/util/json"

options = {
  :title => "Comparison of Ext 4.0.7 and Ext 4.1.1",
@@ -47,7 +47,7 @@ end


def read_class(filename)
  JsDuck::JsonDuck.read(filename)
  JsDuck::Util::Json.read(filename)
end

# loops through all members of class
@@ -301,12 +301,11 @@ EOHTML
html << "<ul>"
diff_data.sort! {|a, b| a[:name] <=> b[:name] }
diff_data.each do |cls|
  if !cls[:found] || cls[:diff].length > 0
  html << "<li>"
  if cls[:found]
    new_name = (cls[:new_name] == cls[:name] ? "" : " --> " + cls[:new_name])
    diff_count = cls[:diff].length > 0 ? "(#{cls[:diff].length} changes)" : ""
      link = cls[:diff].length > 0 ? "<a href='#expand'>#{cls[:name]}</a>" : cls[:name]
    link = cls[:diff].length > 0 ? "<a href='#expand'>#{cls[:name]}</a>" : "<span style='color:green'>"+cls[:name]+'</span>'
    html << "<h2>#{link} #{new_name} #{diff_count}</h2>"
    if cls[:diff].length > 0
      html << "<ul>"
@@ -333,12 +332,12 @@ diff_data.each do |cls|
  end
  html << "</li>"
end
end
html << "</ul>"

html << "<h2>Summary</h2>"
dd = diff_data
html << "<p>" + dd.find_all {|c| !c[:found] }.length.to_s + " classes not found</p>"
html << "<p>" + dd.find_all {|c| c[:found] && c[:diff].length == 0 }.length.to_s + " classes exactly the same</p>"
html << "<p>" + dd.find_all {|c| c[:found] && c[:name] == c[:new_name] }.length.to_s + " classes with same name</p>"
html << "<p>" + dd.find_all {|c| c[:found] && c[:name] != c[:new_name] }.length.to_s + " renamed classes</p>"
html << "<p>" + dd.find_all {|c| c[:diff].length > 0 }.length.to_s + " classes with changed members</p>"