Class: Pindo::Command::Jps::Resign
- Inherits:
-
Pindo::Command::Jps
- Object
- CLAide::Command
- Pindo::Command
- Pindo::Command::Jps
- Pindo::Command::Jps::Resign
- Defined in:
- lib/pindo/command/jps/resign.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
Instance Method Summary collapse
-
#initialize(argv) ⇒ Resign
constructor
A new instance of Resign.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pindo::Command
command_name, #initialize_options, run, use_cache?
Methods included from Funlog::Mixin
Methods included from Pindoconfig::Mixin
Constructor Details
#initialize(argv) ⇒ Resign
Returns a new instance of Resign.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/pindo/command/jps/resign.rb', line 52 def initialize(argv) # 使用 Options 系统解析参数 @options = (argv) # JPS 参数 @args_conf = @options[:conf] @args_list_flag = @options[:list] || false @args_send_flag = @options[:send] || false # Build 参数 @args_bundle_id = @options[:bundleid] super(argv) end |
Class Method Details
.option_items ⇒ Object
定义此命令使用的参数项
41 42 43 44 45 46 |
# File 'lib/pindo/command/jps/resign.rb', line 41 def self.option_items @option_items ||= Pindo::Options::OptionGroup.merge( Pindo::Options::JPSOptions.select(:conf, :send, :list), Pindo::Options::BuildOptions.select(:bundleid) ) end |
.options ⇒ Object
48 49 50 |
# File 'lib/pindo/command/jps/resign.rb', line 48 def self. option_items.map(&:to_claide_option).concat(super) end |
Instance Method Details
#run ⇒ Object
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 |
# File 'lib/pindo/command/jps/resign.rb', line 71 def run # TODO: 此命令尚未完成,等待实现 puts "\n⚠️ 该命令功能尚未完成,敬请期待...\n" # project_path = Dir.pwd # # 1. 登录并获取 JPS 配置 # pgyer_helper = PgyerHelper.share_instace # pgyer_helper.login # app_info_obj, workflow_info = pgyer_helper.prepare_upload( # working_directory: project_path, # conf: @args_conf, # package_type: 'ipa' # 获取 IPA 工作流信息 # ) # if app_info_obj.nil? # raise Informative, "未找到 JPS 项目,请检查配置文件或重新选择" # end # # 2. 创建任务 # tasks = [] # # 2.1 创建重签名任务 # resign_task = Pindo::TaskSystem::JPSResignTask.new( # app_info_obj: app_info_obj, # project_name: nil, # cert_id: @args_bundle_id, # 使用 bundleid 参数 # list_flag: @args_list_flag # ) # tasks << resign_task # # 2.2 创建 JPSMessageTask(发送给自己,依赖重签名任务) # message_task = Pindo::TaskSystem::JPSMessageTask.new( # nil, # app_version_info 为 nil,从依赖任务获取 # app_info_obj: app_info_obj, # project_name: nil, # send_message_type: 'self', # dependencies: [resign_task.id] # ) # tasks << message_task # # 2.3 如果有 --send 参数,创建 JPSWorkFlowMessageTask(发送到工作流群组) # if @args_send_flag # # 获取 Git 工作流信息 # git_app_info_obj, git_workflow_info = pgyer_helper.prepare_upload( # working_directory: project_path, # conf: @args_conf, # package_type: "", # manage_type: "git" # ) # workflow_message_task = Pindo::TaskSystem::JPSWorkFlowMessageTask.new( # project_id: git_app_info_obj["id"], # workflow_id: git_workflow_info["id"], # branch: 'master', # single: true, # app_info_obj: git_app_info_obj, # workflow_info: git_workflow_info # ) # # 依赖重签名任务 # workflow_message_task.dependencies << resign_task.id # tasks << workflow_message_task # end # # 3. 执行任务 # task_manager = Pindo::TaskSystem::TaskManager.instance # task_manager.clear_all # tasks.each { |task| task_manager.add_task(task) } # task_manager.start # # 4. 输出结果 # report = task_manager.execution_report # if report[:success] > 0 # puts "\n✅ 重签名完成!" # else # raise Informative, "重签名失败" # end end |
#validate! ⇒ Object
67 68 69 |
# File 'lib/pindo/command/jps/resign.rb', line 67 def validate! super end |