Class: Pindo::TaskSystem::GitTask
- Defined in:
- lib/pindo/module/task/model/git_task.rb
Overview
Git 任务基类所有 Git 相关任务的父类,提供通用的 Git 操作和配置
Direct Known Subclasses
Instance Attribute Summary collapse
-
#git_root_path ⇒ Object
readonly
Returns the value of attribute git_root_path.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_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
Class Method Summary collapse
- .default_retry_count ⇒ Object
- .default_retry_delay ⇒ Object
-
.default_retry_mode ⇒ Object
Git 任务默认重试配置.
-
.task_type ⇒ Object
Git 任务类型.
-
.task_type_name ⇒ Object
Git 任务类型显示名称.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ GitTask
constructor
A new instance of GitTask.
-
#validate ⇒ Object
验证项目路径.
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(name, options = {}) ⇒ GitTask
Returns a new instance of GitTask.
11 12 13 14 15 16 17 18 |
# File 'lib/pindo/module/task/model/git_task.rb', line 11 def initialize(name, = {}) @project_path = [:project_path] ? File.([:project_path]) : nil # 通过 project_path 获取 git_root_path @git_root_path = @project_path ? Pindo::GitHandler.git_root_directory(local_repo_dir: @project_path) : nil super(name, ) end |
Instance Attribute Details
#git_root_path ⇒ Object (readonly)
Returns the value of attribute git_root_path.
9 10 11 |
# File 'lib/pindo/module/task/model/git_task.rb', line 9 def git_root_path @git_root_path end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
9 10 11 |
# File 'lib/pindo/module/task/model/git_task.rb', line 9 def project_path @project_path end |
Class Method Details
.default_retry_count ⇒ Object
35 36 37 |
# File 'lib/pindo/module/task/model/git_task.rb', line 35 def self.default_retry_count 0 # 默认不重试 end |
.default_retry_delay ⇒ Object
39 40 41 |
# File 'lib/pindo/module/task/model/git_task.rb', line 39 def self.default_retry_delay 5 # 默认延迟 5 秒 end |
.default_retry_mode ⇒ Object
Git 任务默认重试配置
31 32 33 |
# File 'lib/pindo/module/task/model/git_task.rb', line 31 def self.default_retry_mode RetryMode::IMMEDIATE # 立即重试 end |
.task_type ⇒ Object
Git 任务类型
21 22 23 |
# File 'lib/pindo/module/task/model/git_task.rb', line 21 def self.task_type :git end |
.task_type_name ⇒ Object
Git 任务类型显示名称
26 27 28 |
# File 'lib/pindo/module/task/model/git_task.rb', line 26 def self.task_type_name "Git操作" end |
Instance Method Details
#validate ⇒ Object
验证项目路径
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pindo/module/task/model/git_task.rb', line 44 def validate super unless @project_path && Dir.exist?(@project_path) @error = "项目路径不存在:#{@project_path}" return false end true end |