Class: ZergXcode::Objects::PBXProject

Inherits:
XcodeObject show all
Defined in:
lib/zerg_xcode/objects/pbx_project.rb

Overview

The root object in the Xcode object graph.

Defined Under Namespace

Modules: FileVisitor

Instance Attribute Summary collapse

Attributes inherited from XcodeObject

#archive_id, #version

Instance Method Summary collapse

Methods inherited from XcodeObject

#[], #[]=, #_attr_hash, #attrs, from, #initialize, #isa, new, #shallow_copy, #visit, #visit_array, #visit_hash, #visit_once, #visit_value, #xref_key

Constructor Details

This class inherits a constructor from ZergXcode::XcodeObject

Instance Attribute Details

#source_filenameObject

Used to implement save! and to support builds.



14
15
16
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 14

def source_filename
  @source_filename
end

Instance Method Details

#all_filesObject

All the files referenced by the project.



34
35
36
37
38
39
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 34

def all_files
  files = []
  project_root = self['projectRoot'].empty? ? '.' : self['projectRoot']
  FileVisitor.visit self['mainGroup'], project_root, files
  files
end

#copy_metadata(source) ⇒ Object

:nodoc: override to copy the new metadata



17
18
19
20
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 17

def (source)
  super
  self.source_filename = source.source_filename
end

#root_pathObject

The root path of the project.



29
30
31
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 29

def root_path
  ZergXcode.project_root_at source_filename
end

#save!Object

Saves a project that was loaded by ZergXcode.load



23
24
25
26
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 23

def save!
  raise 'Project not loaded by ZergXcode.load' unless @source_filename
  ZergXcode.dump self, @source_filename
end

#xref_nameObject

:nodoc: override xref_name because PBXProject is a singleton



42
43
44
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 42

def xref_name
  isa.to_s
end