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.



30
31
32
33
# File 'lib/xcodeproject/build_phase_node.rb', line 30

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

Instance Method Details

#add_file(file_obj) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/xcodeproject/build_phase_node.rb', line 39

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



61
62
63
64
65
66
67
68
69
# File 'lib/xcodeproject/build_phase_node.rb', line 61

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



35
36
37
# File 'lib/xcodeproject/build_phase_node.rb', line 35

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

#remove_file(file_obj) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/xcodeproject/build_phase_node.rb', line 50

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