Module: Xcode::PLUTILProjectParser

Extended by:
PLUTILProjectParser
Included in:
PLUTILProjectParser
Defined in:
lib/xcode/parsers/plutil_project_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(path) ⇒ Object

Using the sytem tool plutil, the specified project file is parsed and converted to XML, and then converted into a ruby hash object.



13
14
15
16
17
18
19
# File 'lib/xcode/parsers/plutil_project_parser.rb', line 13

def parse(path)
  registry = Plist.parse_xml open_project_file(path)
  
  raise "Failed to correctly parse the project file #{path}" unless registry
  
  registry
end

#save(path, data) ⇒ Object

Save the outputed string data to the specified project file path and then formats that data to be prettier than the default output.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/xcode/parsers/plutil_project_parser.rb', line 25

def save(path,data)
 
  File.open(path,'w') do |file|
    file.puts data
  end

  if File.exists?(path)
    `pl -input #{path} -output #{path}`
  end

end