Class: Pindo::Command::Unity::Packbuild

Inherits:
Pindo::Command::Unity show all
Defined in:
lib/pindo/command/unity/packbuild.rb

Constant Summary

Constants inherited from Pindo::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary

Attributes inherited from Pindo::Command

#args_help_flag

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pindo::Command

run, use_cache?, #validate!

Methods included from Funlog::Mixin

#pindo_log_instance

Methods included from Pindoconfig::Mixin

#pindo_single_config

Methods included from Githelper

#add_branch, #add_tag, #add_tag_with_check, #clone_clang_repo, #clone_devclang_repo, #clone_pindo_common_config_repo, #clone_pindo_env_config_repo, #clong_buildconfig_repo, #get_repo_base_name, #getcode_to_dir, #git_addpush_repo, #git_latest_commit_id, #git_root_directory, #is_git_directory?, #local_branch_exists?, #local_tag_exists?, #prepare_gitenv, #process_need_add_files, #remote_branch_exists?, #remote_tag_exists?, #remove_branch, #remove_tag

Methods included from Executable

capture_command, #executable, execute_command, which, which!

Constructor Details

#initialize(argv) ⇒ Packbuild

Returns a new instance of Packbuild.



39
40
41
# File 'lib/pindo/command/unity/packbuild.rb', line 39

def initialize(argv)
  super
end

Class Method Details

.argumentsObject



31
32
33
# File 'lib/pindo/command/unity/packbuild.rb', line 31

def self.arguments
  []
end

.optionsObject



35
36
37
# File 'lib/pindo/command/unity/packbuild.rb', line 35

def self.options
  [].concat(super)
end

Instance Method Details

#runObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pindo/command/unity/packbuild.rb', line 43

def run
  package_dir = Dir.pwd

  puts "=" * 60
  puts "📦 Unity Package 打包"
  puts "=" * 60
  puts

  # 先执行 packinit 命令进行检查和同步
  puts "🔍 执行初始化检查..."
  initpack_cmd = Pindo::Command::Unity::Packinit.new(CLAide::ARGV.new([]))
  initpack_cmd.run
  puts

  # 获取 nuspec 文件路径
  status = Pindo::Unity::NugetHelper.detect_files(package_dir)
  nuspec_file = status[:nuspec_file]

  # 生成 Release Notes(从 Git 提交历史)
  puts "📝 生成 Release Notes..."
  release_notes = Pindo::Unity::NugetHelper.generate_release_notes_from_git(package_dir)

  if release_notes && !release_notes.empty?
    # 更新 .nuspec 文件
    Pindo::Unity::NugetHelper.update_nuspec_release_notes(nuspec_file, release_notes)
    puts "✅ 已更新 .nuspec 的 releaseNotes 字段"
    puts
  else
    puts "⚠️  未生成 Release Notes,将使用 .nuspec 中已有的内容"
    puts
  end

  # 执行打包
  nupkg_file = Pindo::Unity::NugetHelper.pack_nupkg(package_dir)

  puts
  puts "=" * 60
  puts "✅ 打包完成!"
  puts "=" * 60
  puts
  puts "生成文件:"
  puts "  #{nupkg_file}"
  puts
  puts "下一步:"
  puts "  运行 pindo unity packpush 上传到 JPS"
end