Class: Pindo::Command::Appstore::Configproj

Inherits:
Pindo::Command::Appstore show all
Defined in:
lib/pindo/command/appstore/configproj.rb

Constant Summary

Constants inherited from Pindo::Command

DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS

Instance Attribute Summary

Attributes inherited from Pindo::Command

#args_help_flag

Instance Method Summary collapse

Methods inherited from Pindo::Command

command_name, #initialize_options, options, 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, popen3, reader, which, which!

Constructor Details

#initialize(argv) ⇒ Configproj

Returns a new instance of Configproj.



35
36
37
# File 'lib/pindo/command/appstore/configproj.rb', line 35

def initialize(argv)
  super
end

Instance Method Details

#runObject



39
40
41
42
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
# File 'lib/pindo/command/appstore/configproj.rb', line 39

def run
  # 使用当前目录
  project_dir = Dir.pwd
  config_file = File.join(project_dir, "config.json")

  # 检查配置文件是否存在
  unless File.exist?(config_file)
    raise Informative, "配置文件不存在: #{config_file}"
  end

  # 加载配置文件(会自动检查配置版本)
  config_parser = Pindo::IosConfigParser.instance
  config_parser.load_config(config_file: config_file)

  # 获取 bundle_id 进行验证
  bundle_id = config_parser.bundle_id
  if bundle_id.nil? || bundle_id.empty?
    raise Informative, "无法从配置文件中获取 Bundle ID"
  end

  puts "开始配置 Xcode 项目..."
  puts "  项目目录: #{project_dir}"
  puts "  配置文件: #{config_file}"
  puts "  Bundle ID: #{bundle_id}"
  puts ""

  # 调用封装的方法(使用已加载的 IosConfigParser 单例)
  success = Pindo::XcodeBuildConfig.configure_xcode_project(
    project_dir: project_dir
  )

  if success
    puts ""
    puts "✓ Xcode 项目配置完成!"
  else
    raise Informative, "Xcode 项目配置失败,请检查日志"
  end
end