Created
August 17, 2010 17:42
-
-
Save alexvollmer/531053 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env macruby -wKU | |
framework 'CoreData' | |
def dump_mom(mom_path, out) | |
mom = NSManagedObjectModel.alloc.initWithContentsOfURL(mom_path) | |
mom.entities.sort_by {|e| e.name}.each do |entity| | |
out.puts "-" * 80 | |
out.puts entity.name | |
entity.attributesByName.keys.sort.each do |k| | |
v = entity.attributesByName[k] | |
out.puts "\t#{k}" | |
out.puts "\t\ttype=#{v.attributeType}" | |
out.puts "\t\tdefault=#{v.defaultValue}" | |
out.puts "\t\thash=#{v.versionHash.description}" | |
end | |
end | |
end | |
ARGV.each do |momd| | |
mom_path = NSURL.fileURLWithPath(momd) | |
puts mom_path.absoluteString | |
dump_mom(mom_path, STDOUT) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment