Class: Pindo::TaskSystem::AppStoreUploadIpaTask

Inherits:
AppStoreTask show all
Defined in:
lib/pindo/module/task/model/appstore/appstore_upload_ipa_task.rb

Overview

App Store IPA 上传任务上传 IPA 文件到 App Store Connect

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, #started_at, #status, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AppStoreTask

task_type

Methods inherited from PindoTask

#before_retry, #cancel, #cancelled?, #check_cancelled!, #do_task, #execution_time, #finished?, #on, #reset_for_retry, #retryable?, #running?, #should_retry?, task_type

Constructor Details

#initialize(ipa_path, ipa_file = nil, options = {}) ⇒ AppStoreUploadIpaTask

初始化 IPA 上传任务

Parameters:

  • ipa_path (String)

    搜索 IPA 文件的路径

  • ipa_file (String) (defaults to: nil)

    要上传的 IPA 文件(nil 表示自动查找)

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

    选项

Options Hash (options):

  • :apple_id (String)

    Apple ID(App Store Connect 账号)

  • :app_password (String)

    App专用密码或API Key

  • :bundle_id (String)

    Bundle ID

  • :skip_validation (Boolean)

    是否跳过验证(默认 false)

  • :platform (String)

    平台(ios/osx,默认 ios)



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pindo/module/task/model/appstore/appstore_upload_ipa_task.rb', line 33

def initialize(ipa_path, ipa_file = nil, options = {})
  @ipa_path = ipa_path          # 搜索 IPA 文件的路径
  @ipa_file = ipa_file          # 要上传的 IPA 文件(nil 表示自动查找)

  # App Store Connect 配置
  @apple_id = options[:apple_id]
  @app_password = options[:app_password]
  @bundle_id = options[:bundle_id]
  @skip_validation = options[:skip_validation] || false
  @platform = options[:platform] || 'ios'

  # 设置上传任务的优先级为 LOW,确保在构建任务之后执行
  options[:priority] ||= TaskPriority::LOW

  super("上传 IPA 到 App Store", options)
end

Instance Attribute Details

#ipa_fileObject (readonly)

Returns the value of attribute ipa_file.



9
10
11
# File 'lib/pindo/module/task/model/appstore/appstore_upload_ipa_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/appstore/appstore_upload_ipa_task.rb', line 9

def ipa_path
  @ipa_path
end

Class Method Details

.default_retry_countObject



16
17
18
# File 'lib/pindo/module/task/model/appstore/appstore_upload_ipa_task.rb', line 16

def self.default_retry_count
  3  # 默认可以重试 3 次
end

.default_retry_delayObject



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

def self.default_retry_delay
  30  # 默认延迟 30 秒(App Store 上传较慢)
end

.default_retry_modeObject

重试配置



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

def self.default_retry_mode
  RetryMode::DELAYED  # 延迟重试
end

Instance Method Details

#validateObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/pindo/module/task/model/appstore/appstore_upload_ipa_task.rb', line 50

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

  # IPA 文件会在 do_work 中查找,这里不验证

  true
end