Class: Pindo::TaskSystem::IpaLocalResignTask

Inherits:
PindoTask
  • Object
show all
Defined in:
lib/pindo/module/task/model/resign/ipa_local_resign_task.rb

Overview

IPA 本地重签名任务使用新的证书和 Bundle ID 对 IPA 文件进行重签名

Instance Attribute Summary collapse

Attributes inherited from PindoTask

#callbacks_setup, #context, #created_at, #dependencies, #error, #finished_at, #id, #max_retry_count, #metadata, #name, #priority, #result, #retry_count, #retry_delay, #retry_mode, #skip_count, #started_at, #status, #task_key, #task_manager, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PindoTask

#before_retry, #cancel, #cancelled?, #check_cancelled!, #data_param, #do_task, #execution_time, #finished?, #get_all_data_params, #get_all_data_params_by_key, #get_all_dependencies_results, #get_data_param, #get_data_param_by_key, #get_dependency_result, #get_dependency_task, #on, #primary_data_param, #release_resource, #release_resources, #required_resources, #reset_for_retry, #retryable?, #running?, #should_retry?, #with_resource, #with_resources

Constructor Details

#initialize(ipa_path, ipa_file, bundle_id, options = {}) ⇒ IpaLocalResignTask

初始化重签名任务

Parameters:

  • ipa_path (String)

    IPA 搜索路径(当 ipa_file 为 nil 时使用)

  • ipa_file (String)

    指定的 IPA 文件(nil 表示自动查找)

  • bundle_id (String)

    目标 Bundle ID

  • options (Hash) (defaults to: {})

    选项

Options Hash (options):

  • :build_type (String)

    构建类型(‘dev’/‘adhoc’/‘appstore’/‘development’/‘developer_id’,默认 ‘adhoc’)

  • :project_dir (String)

    项目目录(用于加载 config.json)

  • :cert_mode (String)

    证书操作方式(‘match’/‘custom’,默认 nil 由 Cert 命令决定)

  • :storage (String)

    证书存储后端(‘git’/‘https’/‘s3’,默认 nil 由 Cert 命令决定)

  • :platform_type (String)

    平台类型(‘ios’/‘macos’,默认 nil)



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 52

def initialize(ipa_path, ipa_file, bundle_id, options = {})
  @ipa_path = ipa_path          # IPA 搜索路径
  @ipa_file = ipa_file          # 指定的 IPA 文件(nil 表示自动查找)
  @bundle_id = bundle_id        # 目标 Bundle ID
  @build_type = options[:build_type] || 'adhoc'
  @project_dir = options[:project_dir] || Dir.pwd
  @cert_mode = options[:cert_mode]
  @storage = options[:storage]
  @platform_type = options[:platform_type]

  # 设置任务优先级
  options[:priority] ||= TaskPriority::HIGH

  super("重签名 IPA", options)
end

Instance Attribute Details

#build_typeObject (readonly)

Returns the value of attribute build_type.



12
13
14
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 12

def build_type
  @build_type
end

#bundle_idObject (readonly)

Returns the value of attribute bundle_id.



12
13
14
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 12

def bundle_id
  @bundle_id
end

#ipa_fileObject (readonly)

Returns the value of attribute ipa_file.



12
13
14
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 12

def ipa_file
  @ipa_file
end

#ipa_pathObject (readonly)

Returns the value of attribute ipa_path.



12
13
14
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 12

def ipa_path
  @ipa_path
end

Class Method Details

.default_retry_countObject



34
35
36
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 34

def self.default_retry_count
  2  # 允许重试 2 次
end

.default_retry_delayObject



38
39
40
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 38

def self.default_retry_delay
  5  # 延迟 5 秒
end

.default_retry_modeObject

重试配置



30
31
32
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 30

def self.default_retry_mode
  RetryMode::DELAYED
end

.task_keyObject

任务键



20
21
22
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 20

def self.task_key
  :ipa_local_resign
end

.task_typeObject

任务类型



15
16
17
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 15

def self.task_type
  :resign
end

.task_type_nameObject

任务类型显示名称



25
26
27
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 25

def self.task_type_name
  "重签名"
end

Instance Method Details

#validateObject

验证任务参数



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 69

def validate
  # 验证 Bundle ID
  unless @bundle_id && !@bundle_id.empty?
    @error = "缺少必需参数: bundle_id"
    return false
  end

  # 验证 build_type
  valid_build_types = %w[dev adhoc appstore development developer_id]
  unless valid_build_types.include?(@build_type)
    @error = "无效的 build_type: #{@build_type}(必须是 #{valid_build_types.join('/')}"
    return false
  end

  # 验证 ipa_path(当 ipa_file 为空时)
  if (@ipa_file.nil? || @ipa_file.empty?)
    unless @ipa_path && !@ipa_path.empty?
      @error = "缺少必需参数: ipa_path(当 ipa_file 未指定时)"
      return false
    end
  end

  true
end