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!



4
5
6
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 4

def source_filename
  @source_filename
end

Instance Method Details

#all_filesObject

All the files referenced by the project.



24
25
26
27
28
29
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 24

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



7
8
9
10
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 7

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

#root_pathObject

The root path of the project.



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

def root_path
  ZergXcode::Paths.project_root_at source_filename
end

#save!Object

Saves a project that was loaded by ZergXcode.load



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

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



32
33
34
# File 'lib/zerg_xcode/objects/pbx_project.rb', line 32

def xref_name
  isa.to_s
end