Class: Pindo::TaskSystem::UnityConfigTask

Inherits:
UnityTask show all
Defined in:
lib/pindo/module/task/model/unity/unity_config_task.rb

Overview

Unity 配置编译模式任务用于配置 Unity 项目的编译模式(dev/adhoc/release)

Instance Attribute Summary collapse

Attributes inherited from UnityTask

#project_path, #unity_root_path

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

Instance Method Summary collapse

Methods inherited from UnityTask

#before_retry, default_retry_count, default_retry_delay, default_retry_mode, task_type, task_type_name, #unity_helper

Methods inherited from PindoTask

#before_retry, #cancel, #cancelled?, #check_cancelled!, #data_param, default_retry_count, default_retry_delay, default_retry_mode, #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, task_type

Constructor Details

#initialize(deploy_mode = 'dev', options = {}) ⇒ UnityConfigTask

Returns a new instance of UnityConfigTask.

Parameters:

  • deploy_mode (String) (defaults to: 'dev')

    部署模式 (‘dev’, ‘adhoc’, ‘release’)

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

    额外选项

    • :project_path [String] Unity 项目路径(默认当前目录)



14
15
16
17
18
19
20
21
# File 'lib/pindo/module/task/model/unity/unity_config_task.rb', line 14

def initialize(deploy_mode = 'dev', options = {})
  @deploy_mode = deploy_mode
  @unity_exe_path = nil  # 将在 do_work 中自动查找

  # 传递 project_path 给基类
  project_path = options[:project_path] || Dir.pwd
  super("Unity 配置编译模式 (#{deploy_mode})", project_path: project_path, options: options)
end

Instance Attribute Details

#deploy_modeObject (readonly)

Returns the value of attribute deploy_mode.



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

def deploy_mode
  @deploy_mode
end

Instance Method Details

#validateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pindo/module/task/model/unity/unity_config_task.rb', line 23

def validate
  super

  # 验证 Unity 工程是否存在
  unless unity_helper.unity_project?(@unity_root_path)
    raise Informative, "当前目录不是 Unity 工程:#{@unity_root_path}"
  end

  # 验证 deploy_mode 参数
  valid_modes = ['dev', 'adhoc', 'release']
  unless valid_modes.include?(@deploy_mode)
    raise Informative, "无效的编译模式: #{@deploy_mode},必须是 #{valid_modes.join(', ')}"
  end

  true
end