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
142
143
144
145
146
|
# File 'lib/pindo/module/build/commonconfuseproj.rb', line 81
def config_symash(clang_path:nil, project_path:nil, confuse_type:nil, default_type:"symash1")
FileUtils.cp_r(File.join(clang_path, "config", "Symash.json"), project_path)
text = File.read(File.join(project_path, "Symash.json"))
new_contents = text.gsub(/\"IMPORT\".*/, "\"IMPORT\":false,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_PROTOCOL\".*/, "\"IGNORE_SYMASH_PROTOCOL\":true,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_INTERFACE\".*/, "\"IGNORE_SYMASH_INTERFACE\":true,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_CATEGORY\".*/, "\"IGNORE_SYMASH_CATEGORY\":true,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_PROPERTY\".*/, "\"IGNORE_SYMASH_PROPERTY\":true,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_IVAR\".*/, "\"IGNORE_SYMASH_IVAR\":true,")
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_METHOD\".*/, "\"IGNORE_SYMASH_METHOD\":true,")
confuse_type_temp = confuse_type
puts confuse_type_temp
if confuse_type_temp.include? "class"
puts "Open Confuse Class!"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_INTERFACE\".*/, "\"IGNORE_SYMASH_INTERFACE\":false,")
end
if confuse_type_temp.include? "method"
puts "Open Confuse Methon"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_METHOD\".*/, "\"IGNORE_SYMASH_METHOD\":false,")
end
if confuse_type_temp.include? "variable"
puts "Open Confuse Variable"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_IVAR\".*/, "\"IGNORE_SYMASH_IVAR\":false,")
end
if confuse_type_temp.include? "protocol"
puts "Open Confuse Protocol"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_PROTOCOL\".*/, "\"IGNORE_SYMASH_PROTOCOL\":false,")
end
if confuse_type_temp.include? "property"
puts "Open Confuse Property"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_PROPERTY\".*/, "\"IGNORE_SYMASH_PROPERTY\":false,")
end
if confuse_type_temp.include? "category"
puts "Open Confuse Category"
new_contents = new_contents.gsub(/\"IGNORE_SYMASH_CATEGORY\".*/, "\"IGNORE_SYMASH_CATEGORY\":false,")
end
new_contents = new_contents.gsub(/\"ENABLE_BACKEND_SYMASH\".*/, "\"ENABLE_BACKEND_SYMASH\":true,")
new_contents = new_contents.gsub(/\"ENABLE_BACKEND_SYMASH2\".*/, "\"ENABLE_BACKEND_SYMASH2\":true,")
new_contents = new_contents.gsub(/\"ENABLE_DUPLICATE_METHOD\".*/, "\"ENABLE_DUPLICATE_METHOD\":true,")
File.open(File.join(project_path, "Symash.json"), "w") {|file| file.puts new_contents }
if default_type == "symash1"
if File.exist?(File.join(project_path, "SymashCache"))
FileUtils.rm_rf(File.join(project_path, "SymashCache"))
end
FileUtils.mkdir(File.join(project_path, "SymashCache"))
else
if File.exist?(File.join(project_path, "SymashData"))
FileUtils.rm_rf(File.join(project_path, "SymashData"))
end
FileUtils.mkdir(File.join(project_path, "SymashData"))
end
end
|