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
142
143
144
145
146
|
# File 'lib/dongjia_router.rb', line 91
def scrape_routers(sandbox_root, config)
if config == nil
return
end
result_file_path = ''
path = config[:path]
if path && path.length > 0
result_file_path = File.expand_path(File.join(sandbox_root, '..', path))
end
if !File.exist?(result_file_path)
Pod::UI.warn("Router scrapy: path not found.")
return
end
route_items = []
Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
if name != 'Pods.xcodeproj'
proj.targets.each do |target|
next unless target.name.start_with?('DJ')
next unless target.is_a?(Xcodeproj::Project::Object::PBXNativeTarget)
target.source_build_phase.files_references.each do |file|
next if file.path.end_with?('Api.m')
next if file.path.end_with?('Model.m')
next if file.path.end_with?('-dummy.m')
next if file.path.end_with?('Log.m')
route_items += route_items_from_file(file.real_path)
end
end
end
end
route_items.sort! do |a, b|
a.redirect_type.to_i <=> b.redirect_type.to_i
end
result =
route_items.each do |item|
result += item.output
end
FileUtils.chmod('u+w', result_file_path)
File.open(result_file_path, 'w') do |f|
f.write(result)
end
FileUtils.chmod('ugo-w', result_file_path)
end
|