Created
November 29, 2010 13:51
-
-
Save massive/719970 to your computer and use it in GitHub Desktop.
Revisions
-
massive revised this gist
Nov 30, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Run: curl https://gist.github.com/raw/719970/locale_diff.rb | ruby - en fi require 'rubygems' require 'yaml' l1 = ARGV[0] l2 = ARGV[1] -
massive revised this gist
Nov 30, 2010 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,13 @@ def diff(root, compared, structure = []) next_root = root[key] next_compared = compared.nil? ? nil : compared[key] new_structure = structure.dup << key if compared.nil? || compared[key].nil? print "#{new_structure.join(".")}" print ": \"#{root[key]}\"" if next_root.kind_of? String print "\n" end diff(next_root, next_compared, new_structure) if next_root.kind_of? Hash end end -
massive renamed this gist
Nov 29, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
massive created this gist
Nov 29, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ require 'rubygems' require 'yaml' require 'pp' l1 = ARGV[0] l2 = ARGV[1] first = YAML.load_file(l1 + ".yml") second = YAML.load_file(l2 + ".yml") def diff(root, compared, structure = []) root.each_key do |key| next_root = root[key] next_compared = compared.nil? ? nil : compared[key] new_structure = structure.dup << key puts "#{new_structure.join(".")}" if compared.nil? || compared[key].nil? diff(next_root, next_compared, new_structure) if next_root.kind_of? Hash end end puts "MISSING FROM #{l2}" diff(first[l1], second[l2], [l2]) puts "\nMISSING FROM #{l1}" diff(second[l2], first[l1], [l1])