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.



28
29
30
31
# File 'lib/xcodeproject/build_phase_node.rb', line 28

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

Instance Method Details

#add_file(file_obj) ⇒ Object



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

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



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

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



33
34
35
# File 'lib/xcodeproject/build_phase_node.rb', line 33

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

#remove_file(file_obj) ⇒ Object



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

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