Class: XcodeProject::BuildPhaseNode

Inherits:
Node
  • Object
show all
Defined in:
lib/xcodeproject/build_phase_node.rb

Instance Attribute Summary

Attributes inherited from Node

#isa, #uuid

Instance Method Summary collapse

Constructor Details

#initialize(root, uuid, data) ⇒ BuildPhaseNode

Returns a new instance of BuildPhaseNode.



6
7
8
9
# File 'lib/xcodeproject/build_phase_node.rb', line 6

def initialize (root, uuid, data)
	super(root, uuid, data)
	@files = data['files']
end

Instance Method Details

#add_file(file_obj) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/xcodeproject/build_phase_node.rb', line 15

def add_file (file_obj)
	case file_obj
		when PBXFileReference
			add_build_file(file_obj.uuid)
		when PBXBuildFile
			add_build_file_uuid(file_obj.uuid)
		else 
			raise ArgumentError.new("Wrong argument type, expected the PBXFileReference or PBXBuildFile.")
	end
end

#doctorObject



37
38
39
40
41
42
43
44
45
# File 'lib/xcodeproject/build_phase_node.rb', line 37

def doctor
	@files.each do |uuid|
		obj = root.object(uuid)
		if obj.nil?
			remove_build_file_uuid(uuid)
			puts "removed #{uuid}"
		end
	end
end

#filesObject



11
12
13
# File 'lib/xcodeproject/build_phase_node.rb', line 11

def files
	build_files.map {|obj| obj.file_ref }
end

#remove_file(file_obj) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/xcodeproject/build_phase_node.rb', line 26

def remove_file (file_obj)
	case file_obj
		when PBXFileReference
			remove_build_file(file_obj.uuid)
		when PBXBuildFile
			remove_build_file_uuid(file_obj.uuid)
		else 
			raise ArgumentError.new("Wrong argument type, expected the PBXFileReference or PBXBuildFile.")
	end
end