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, #data_dependencies, #dependencies, #error, #finished_at, #id, #max_retry_count, #metadata, #name, #priority, #result, #retry_count, #retry_delay, #retry_mode, #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, #reset_for_retry, #retryable?, #running?, #should_retry?, task_key

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’,默认 ‘adhoc’)

  • :project_dir (String)

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



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 41

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

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

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

Instance Attribute Details

#build_typeObject (readonly)

Returns the value of attribute build_type.



9
10
11
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 9

def build_type
  @build_type
end

#bundle_idObject (readonly)

Returns the value of attribute bundle_id.



9
10
11
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 9

def bundle_id
  @bundle_id
end

#ipa_fileObject (readonly)

Returns the value of attribute ipa_file.



9
10
11
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 9

def ipa_file
  @ipa_file
end

#ipa_pathObject (readonly)

Returns the value of attribute ipa_path.



9
10
11
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 9

def ipa_path
  @ipa_path
end

Class Method Details

.default_retry_countObject



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

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

.default_retry_delayObject



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

def self.default_retry_delay
  5  # 延迟 5 秒
end

.default_retry_modeObject

重试配置



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

def self.default_retry_mode
  RetryMode::DELAYED
end

.task_typeObject

任务类型



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

def self.task_type
  :resign
end

.task_type_nameObject

任务类型显示名称



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

def self.task_type_name
  "重签名"
end

Instance Method Details

#validateObject

验证任务参数



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/pindo/module/task/model/resign/ipa_local_resign_task.rb', line 55

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

  # 验证 build_type
  unless ['dev', 'adhoc'].include?(@build_type)
    @error = "无效的 build_type: #{@build_type}(必须是 'dev' 或 'adhoc')"
    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