75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# File 'lib/xsort/xcodeproj/pbxproj/pbxobject/Pbxproj.rb', line 75
def parse ()
isPbxGroup = false
isPbxOneValue = false
isPbxChild = false
pbxValue = ""
begin
File.open(@path, "r") do |pbx|
pbx.each_line do |pbx_line|
if @stdout == true
puts pbx_line
end
if pbx_line.index("/* End PBXGroup section */")
isPbxGroup = false
end
if isPbxGroup == true
if pbx_line.index(");")
isPbxChild = false
end
if isPbxChild == true
name = Emurate.emurates(pbx_line)
@child = Xcodeproj::Pbxproj::PbxObject::PbxChild.new(name,pbx_line)
@group.setChildren(@child)
end
if pbx_line.index("children = (")
isPbxChild = true
end
if pbx_line.index(" = {")
isPbxOneValue = true
name = Emurate.emurates(pbx_line)
@group = Xcodeproj::Pbxproj::PbxObject::PbxGroup.new
end
if isPbxOneValue == true
pbxValue << pbx_line
end
if pbx_line.index("};")
isPbxOneValue = false
@group.setPbxBase(pbxValue)
@pbxGroups.push(@group)
pbxValue = ""
end
end
if pbx_line.index("/* Begin PBXGroup section */")
isPbxGroup = true
end
end
end
rescue IOError => ioerr
puts "Error #{ioerr.message}"
rescue SystemCallError => sysCallErr
puts "Failuer: reason #{sysCallErr.message}"
puts "The entered path is invalid."
end
end
|