Class: Pindo::TaskSystem::NugetUploadTask

Inherits:
NugetTask show all
Defined in:
lib/pindo/module/task/model/nuget/nuget_upload_task.rb

Instance Attribute Summary collapse

Attributes inherited from NugetTask

#project_path

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 NugetTask

#required_resources, task_type

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, #release_resource, #release_resources, #required_resources, #reset_for_retry, #retryable?, #running?, #should_retry?, task_type, #validate, #with_resource, #with_resources

Constructor Details

#initialize(project_path:, nupkg_file: nil) ⇒ NugetUploadTask

初始化上传任务

Parameters:

  • project_path (String)

    项目路径

  • nupkg_file (String) (defaults to: nil)

    要上传的 .nupkg 文件路径(可选)



18
19
20
21
# File 'lib/pindo/module/task/model/nuget/nuget_upload_task.rb', line 18

def initialize(project_path:, nupkg_file: nil)
  super("Nuget包上传到JPS", project_path: project_path)
  @nupkg_file = nupkg_file
end

Instance Attribute Details

#nupkg_fileObject (readonly)

Returns the value of attribute nupkg_file.



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

def nupkg_file
  @nupkg_file
end

Class Method Details

.task_keyObject



11
12
13
# File 'lib/pindo/module/task/model/nuget/nuget_upload_task.rb', line 11

def self.task_key
  :nuget_upload
end

Instance Method Details

#do_workObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pindo/module/task/model/nuget/nuget_upload_task.rb', line 23

def do_work
  puts
  puts "📦 [Task] 开始上传 Nuget 包到 JPS..."
  puts

  # 1. 确定要上传的文件
  actual_file = determine_nupkg_file
  unless actual_file && File.exist?(actual_file)
    raise Informative, "未找到 .nupkg 文件"
  end

  # 2. 获取包信息
  package_info = get_package_info

  # 3. 显示上传信息
  display_upload_info(actual_file, package_info)

  # 4. 执行上传
  upload_to_jps(actual_file, package_info)

  puts
  puts "✅ Nuget 包上传完成!"
  puts

  # 返回结果
  {
    uploaded_file: actual_file,
    package_info: package_info
  }
end