Class: Pindo::Command::Deploy::Confusecode
- Inherits:
-
Pindo::Command::Deploy
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Deploy
- Pindo::Command::Deploy::Confusecode
- Defined in:
- lib/pindo/command/deploy/confusecode.rb
Constant Summary
Constants inherited from Pindo::Command
Pindo::Command::DEFAULT_OPTIONS, Pindo::Command::DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
Attributes included from Pindo::Command::DeployOptions
#additional_args, #apple_id, #args_adhoc_flag, #args_appconfig, #args_appconfig_dir, #args_appconfig_fullname, #args_apple_id, #args_appstore_flag, #args_array, #args_bundle_id, #args_dev_flag, #args_macos_flag, #args_repo_name, #argv_temp, #bundle_id, #bundle_id_extension, #bundle_id_extensionad, #bundle_id_extensionporn, #bundle_id_imessage, #bundle_id_keyboard, #bundle_id_pushcontent, #bundle_id_pushservice, #bundle_id_siri, #bundle_id_siriui, #bundle_id_watchapp, #bundle_id_watchapp_extension, #bundle_id_widget, #config_json, #deploy_acount_id, #deploy_group_id, #deploy_icloud_id, #deploy_identifier, #deploy_identifier_extension, #deploy_identifier_extensionad, #deploy_identifier_extensionporn, #deploy_identifier_imessage, #deploy_identifier_keyboard, #deploy_identifier_pushcontent, #deploy_identifier_pushservice, #deploy_identifier_siri, #deploy_identifier_siriui, #deploy_identifier_watchapp, #deploy_identifier_watchapp_extension, #deploy_identifier_widget, #deploy_repo_name, #group_id, #icloud_id, #newconfuse_flag, #oldconfuse_flag
Attributes inherited from Pindo::Command
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Confusecode
constructor
A new instance of Confusecode.
- #run ⇒ Object
Methods included from Pindo::CommonConfuseProj
#_load_symash_plugin, #_push_symash_arg, #config_confuse_project, #config_symash, #confuse_version_type, #external_sources, #install_symash, #process_config_setting, #process_root_setting, #update_symash_config
Methods included from Hashhelper
#deepcopy_hash, #deepcopy_hash_struct, #init_hash_value_wihtout_add_key, #init_hash_value_wihtout_exludekeys, #minus_hash
Methods included from Pindo::Command::DeployOptions
#check_config_version, #get_build_type_args, #get_bundle_id_map, #get_confuse_type_args, #init_deploy_params, #init_develop_params, #print_params_info, #validate!
Methods inherited from Pindo::Command
Methods included from Funlog::Mixin
Methods included from Pindoconfig::Mixin
Methods included from Githelper
#add_branch, #add_tag, #add_tag_with_check, #clone_clang_repo, #clone_devclang_repo, #clone_pindo_common_config_repo, #clone_pindo_env_config_repo, #clong_buildconfig_repo, #get_repo_base_name, #getcode_to_dir, #git_addpush_repo, #git_latest_commit_id, #local_branch_exists?, #local_tag_exists?, #prepare_gitenv, #process_need_add_files, #remote_branch_exists?, #remote_tag_exists?, #remove_branch, #remove_tag
Methods included from Executable
capture_command, #executable, execute_command, which, which!
Constructor Details
#initialize(argv) ⇒ Confusecode
Returns a new instance of Confusecode.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pindo/command/deploy/confusecode.rb', line 32 def initialize(argv) @pull_mode = argv.flag?('pull', false) @push_mode = argv.flag?('push', false) if @push_mode puts "Push Mode ============================================ true" else puts "Push Mode ============================================ false" end if @pull_mode puts "Pull Mode ============================================ true" else puts "Pull Mode ============================================ false" end super end |
Class Method Details
.options ⇒ Object
25 26 27 28 29 30 |
# File 'lib/pindo/command/deploy/confusecode.rb', line 25 def self. [ ['--pull', '拉取混淆配置'], ['--push', '上传混淆配置'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/pindo/command/deploy/confusecode.rb', line 50 def run current_project_dir = Dir.pwd puts "+++++ #{current_project_dir}" app_config_dir = clong_buildconfig_repo(repo_name: @deploy_repo_name) if !File.exist?(app_config_dir) puts "App Config is nil !!!" return end clang_repo_dir = clone_clang_repo # if !File.exist?(clang_repo_dir) puts "#{clang_repo_dir}" puts "There is no clang tool !!! deploy confusecode" # return # end default_symash = "symash2" if @newconfuse_flag default_symash = "symash2" end symash_type = confuse_version_type(path:current_project_dir, default_type:default_symash) confuse_tool_path = File.join(clang_repo_dir, symash_type) puts "Confuse Tool Path: #{confuse_tool_path}" meaning_tool = File.join(clang_repo_dir, "MeaningfulTools/MeaningfulName") if symash_type == "symash1" base_db = File.join(clang_repo_dir, "MeaningfulTools/confuse.db") meaning_db = File.join(app_config_dir, "app_confuse.db") origin_json_dir = File.join(current_project_dir, "SymashCache/Original") output_dir = File.join(current_project_dir, "SymashCache") confuse_type= @confuse_type if File.exist?(File.join(current_project_dir, "Symash.json")) proj_confuse_json=JSON.parse(File.read(File.join(current_project_dir, "Symash.json"))) confuse_type = "pods" if !proj_confuse_json["IGNORE_SYMASH_INTERFACE"] confuse_type = confuse_type + "_class" end if !proj_confuse_json["IGNORE_SYMASH_METHOD"] confuse_type = confuse_type + "_method" end if !proj_confuse_json["IGNORE_SYMASH_PROTOCOL"] confuse_type = confuse_type + "_protocol" end if !proj_confuse_json["IGNORE_SYMASH_PROPERTY"] confuse_type = confuse_type + "_property" end if !proj_confuse_json["IGNORE_SYMASH_CATEGORY"] confuse_type = confuse_type + "_category" end if !proj_confuse_json["IGNORE_SYMASH_IVAR"] confuse_type = confuse_type + "_variable" end end if File.exist?(File.join(output_dir, "Replaced.json")) FileUtils.rm_rf(File.join(output_dir, "Replaced.json")) end puts "Tool: #{meaning_tool}" puts "DB: #{meaning_db}" puts "Origin Dir: #{origin_json_dir}" puts "Output Dir: #{output_dir}" puts "Project Dir: #{current_project_dir}" puts "Confuse Type: #{confuse_type}" if File.exist?(origin_json_dir) command = meaning_tool + " -r -p 100 -i 100 -b " + @deploy_identifier + " -d " + origin_json_dir + " -o " + base_db + " -m " + meaning_db + " -t " + output_dir + " -f " + current_project_dir + " -z " + confuse_type puts "Command: #{command}" system command end text = File.read(File.join(current_project_dir, "Symash.json")) new_contents = text.gsub(/\"IMPORT\".*/, "\"IMPORT\":true,") File.open(File.join(current_project_dir, "Symash.json"), "w") {|file| file.puts new_contents } else output_dir = File.join(current_project_dir, "SymashData") puts "Tool: #{meaning_tool}" puts "+++++++" puts "+++++++" puts "+++++++" service_path = File.join(confuse_tool_path, "/Applications/SymashX.app/Contents/MacOS/symashctl") command1 = "cd #{current_project_dir} && " + service_path + " stop >> /dev/null " puts "Command: #{command1}" system command1 if File.exist?(File.join(current_project_dir, "SymashData/export-sympkg.plist")) command = meaning_tool + " -q -f " + current_project_dir + " -d " + app_config_dir puts "Command: #{command}" system command end puts "+++++++" puts "+++++++" puts "+++++++" end if @pull_mode if File.exist?(File.join(app_config_dir, "Replaced.json")) FileUtils.cp_r(File.join(app_config_dir, "Replaced.json"), File.join(output_dir, "Replaced.json")) end if File.exist?(File.join(app_config_dir, "import-sympkg.plist")) FileUtils.cp_r(File.join(app_config_dir, "import-sympkg.plist"), File.join(output_dir, "import-sympkg.plist")) end if File.exist?(File.join(app_config_dir, "ReplaceAllNames.json")) FileUtils.cp_r(File.join(app_config_dir, "ReplaceAllNames.json"), File.join(output_dir, "ReplaceAllNames.json")) end if File.exist?(File.join(app_config_dir, "Replaced.json")) FileUtils.cp_r(File.join(app_config_dir, "Replaced.json"), File.join(output_dir, "Replaced.json")) end if File.exist?(File.join(output_dir, "MergeClassFiles")) FileUtils.rm_rf(File.join(output_dir, "MergeClassFiles")) end if File.exist?(File.join(app_config_dir, "MergeClassFiles")) FileUtils.cp_r(File.join(app_config_dir, "MergeClassFiles"), output_dir) end repo_backup_json = File.join(app_config_dir, "Backup_MapBundleName.json") project_json = File.join(current_project_dir, "allbundles", "Backup_MapBundleName.json") if File.exist?(repo_backup_json) if !File.exist?(File.join(current_project_dir, "allbundles")) FileUtils.mkdir(File.join(current_project_dir, "allbundles")) end FileUtils.cp_r(repo_backup_json, File.join(project_json)) end end if symash_type == "symash2" service_path = File.join(confuse_tool_path, "/Applications/SymashX.app/Contents/MacOS/symashctl") command2 = "cd #{current_project_dir} && " + service_path + " start -backend" puts "Command: #{command2}" system command2 puts "Done !" end if @push_mode if File.exist?(File.join(current_project_dir, "Symash.json")) FileUtils.cp_r(File.join(current_project_dir, "Symash.json"), File.join(app_config_dir, "Symash.json")) end if File.exist?(File.join(output_dir, "Replaced.json")) FileUtils.cp_r(File.join(output_dir, "Replaced.json"), File.join(app_config_dir, "Replaced.json")) end if File.exist?(File.join(output_dir, "import-sympkg.plist")) FileUtils.cp_r(File.join(output_dir, "import-sympkg.plist"), File.join(app_config_dir, "import-sympkg.plist")) end if File.exist?(File.join(app_config_dir, "MergeClassFiles")) FileUtils.rm_rf(File.join(app_config_dir, "MergeClassFiles")) end if File.exist?(File.join(output_dir, "MergeClassFiles")) FileUtils.cp_r(File.join(output_dir, "MergeClassFiles"), app_config_dir) end new_backup_json = File.join(current_project_dir, "allbundles", "Backup_MapBundleName.json") repo_backup_json = File.join(app_config_dir, "Backup_MapBundleName.json") if File.exist?(new_backup_json) FileUtils.cp_r(new_backup_json, repo_backup_json) end end = @config_json["app_info"]["app_build_version"] = || "" = + "confuse code commit replace.json" git_addpush_repo(path:app_config_dir, message:) end |