Commit 47c22708 authored by Eloy Duran's avatar Eloy Duran

Add rake task that dumps a Xcode project as YAML.

parent 59baa398
......@@ -76,5 +76,37 @@ namespace :spec do
end
end
desc "Dumps a Xcode project as YAML, meant for diffing"
task :dump_xcodeproj do
require 'yaml'
hash = NSDictionary.dictionaryWithContentsOfFile(File.join(ENV['xcodeproj'], 'project.pbxproj'))
objects = hash['objects']
result = objects.values.map do |object|
if children = object['children']
object['children'] = children.map do |uuid|
child = objects[uuid]
child['path'] || child['name']
end.sort
elsif files = object['files']
object['files'] = files.map do |uuid|
build_file = objects[uuid]
file = objects[build_file['fileRef']]
file['path']
end
elsif file_ref = object['fileRef']
file = objects[file_ref]
object['file'] = file['path']
end
object
end
result.each do |object|
object.delete('fileRef')
end
result = result.sort_by do |object|
[object['isa'], object['file'], object['path'], object['name']].compact
end
puts result.to_yaml
end
desc "Run all specs"
task :spec => 'spec:all'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment