Class: Pindo::Command::Appstore::Autoresign
- Inherits:
-
Pindo::Command::Appstore
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Appstore
- Pindo::Command::Appstore::Autoresign
- Includes:
- Appselect
- Defined in:
- lib/pindo/command/appstore/autoresign.rb
Constant Summary
Constants inherited from Pindo::Command
DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
Attributes inherited from Pindo::Command
Class Method Summary collapse
-
.option_items ⇒ Object
定义此命令使用的参数项.
-
.options ⇒ Object
命令的选项列表.
-
.use_cache? ⇒ Boolean
启用缓存机制.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Autoresign
constructor
A new instance of Autoresign.
- #run ⇒ Object
- #validate! ⇒ Object
Methods included from Appselect
#all_deploy_bundle_name, #all_dev_bundle_name, #all_dev_bundleid, #all_itc_bundleid, #all_release_bundleid, #all_tool_bundleid, #deploy_build_setting_json, #dev_build_setting_json, #get_deploy_repo_with_modul_name, #get_deploy_setting_repo, #get_dev_setting_repo, #get_selected_deploy_bundle_name, #get_selected_deploy_bundleid, #get_selected_dev_bundle_name, #get_selected_dev_bundleid, #get_setting_bundleid_withdir, #load_setting, #select_main_app
Methods inherited from Pindo::Command
command_name, #initialize_options, run
Methods included from Funlog::Mixin
Methods included from Pindoconfig::Mixin
Constructor Details
#initialize(argv) ⇒ Autoresign
Returns a new instance of Autoresign.
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 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 103 def initialize(argv) # 首先获取位置参数(向后兼容) positional_ipa = argv.shift_argument # 使用 Options 模块初始化参数 @options = (argv) # 优先使用选项参数,如果没有则使用位置参数 @args_ipa_file = @options[:ipa] || positional_ipa # JPS 参数 @args_upload_flag = @options[:send] || @options[:upload] @args_send_flag = @options[:send] @args_conf = @options[:conf] # 证书快捷参数 @args_adhoc_flag = @options[:adhoc] @args_dev_flag = @options[:dev] @args_develop_id_flag = @options[:develop_id] @args_macos_flag = @options[:macos] @args_match_flag = @options[:match] # 证书模式参数(appstore autoresign 默认: custom + https) @cert_mode = @options[:cert_mode] || 'custom' @storage = @options[:storage] || 'https' # 处理 --match 快捷方式 if @args_match_flag @cert_mode = 'match' @storage = 'git' end # 构建类型优先级:--develop_id > --adhoc > --dev > --build_type > 默认 adhoc @args_build_type = @options[:build_type] if @args_develop_id_flag @args_build_type = 'developer_id' elsif @args_adhoc_flag @args_build_type = 'adhoc' elsif @args_dev_flag @args_build_type = 'dev' elsif @args_build_type.nil? || @args_build_type.to_s.empty? @args_build_type = 'adhoc' end # 标准化构建类型 @args_build_type = Pindo::Options::BuildOptions.normalize_build_type(@args_build_type) # 处理平台类型 @platform_type = @options[:platform] if @args_macos_flag @platform_type = 'macos' end # macOS 平台特殊处理 if @platform_type == 'macos' && @args_build_type == 'adhoc' @args_build_type = 'developer_id' end super @additional_args = argv.remainder! end |
Class Method Details
.option_items ⇒ Object
定义此命令使用的参数项
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 74 def self.option_items @option_items ||= begin items = [] # 添加工具参数(ToolOptions) items.concat(Pindo::Options::ToolOptions.select(:ipa)) # 添加构建类型参数(BuildOptions) items.concat(Pindo::Options::BuildOptions.select( :dev, :adhoc, :develop_id, :build_type )) # 添加证书相关参数(CertOptions) items.concat(Pindo::Options::CertOptions.select( :platform, :macos, :cert_mode, :storage, :match )) # 合并 JPSOptions items.concat(Pindo::Options::JPSOptions.select(:conf, :upload, :send)) items end end |
.options ⇒ Object
命令的选项列表
99 100 101 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 99 def self. option_items.map { |item| item.to_claide_option }.concat(super) end |
.use_cache? ⇒ Boolean
启用缓存机制
25 26 27 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 25 def self.use_cache? true end |
Instance Method Details
#run ⇒ Object
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 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 169 def run begin # 加载 JPS 配置(如果存在) Pindo::BuildHelper.share_instance.load_jps_build_config(Dir.pwd, conf: @args_conf) # 1. 查找或指定 IPA 文件 ipa_file_path = find_ipa_file() unless ipa_file_path && File.exist?(ipa_file_path) raise Informative, "未找到需要重签名的 IPA 文件" end # 2. 选择 Bundle ID(根据 build_type) bundle_id = select_bundle_id() # 3. 拉取应用配置 pull_app_config(bundle_id) # 4. 准备 JPS 配置(如果需要上传) app_info_obj, workflow_info = prepare_jps_config() # 5. 计算重签名后的 IPA 文件名 resigned_ipa_file = calculate_resigned_ipa_name(ipa_file_path) # 6. 创建任务 tasks = create_resign_tasks( ipa_file_path: ipa_file_path, resigned_ipa_file: resigned_ipa_file, bundle_id: bundle_id, app_info_obj: app_info_obj, workflow_info: workflow_info ) # 7. 执行任务 task_manager = Pindo::TaskSystem::TaskManager.instance task_manager.clear_all tasks.each { |task| task_manager.add_task(task) } task_manager.start ensure # 清除命令状态(如果启用了缓存,这里会自动保存) Pindo::Options::GlobalOptionsState.instance.clear end end |
#validate! ⇒ Object
165 166 167 |
# File 'lib/pindo/command/appstore/autoresign.rb', line 165 def validate! super end |