Class: Pindo::Command::Appstore::Tag

Inherits:
Pindo::Command::Appstore show all
Defined in:
lib/pindo/command/appstore/tag.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

command_name, #initialize_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) ⇒ Tag

Returns a new instance of Tag.



33
34
35
36
# File 'lib/pindo/command/appstore/tag.rb', line 33

def initialize(argv)
    @delete_tag_name = argv.option('delete')
    super
end

Class Method Details

.optionsObject



27
28
29
30
31
# File 'lib/pindo/command/appstore/tag.rb', line 27

def self.options
  [
    ['--delete=TAG_NAME', '删除指定的tag'],
  ].concat(super)
end

Instance Method Details

#runObject



38
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
# File 'lib/pindo/command/appstore/tag.rb', line 38

def run

    project_dir = Dir.pwd
    config_file = File.join(project_dir, "config.json")

    # 加载配置
    config_parser = Pindo::IosConfigParser.instance
    config_parser.load_config(config_file: config_file)
    config_json = config_parser.config_json
    bundle_id = config_parser.bundle_id

    if config_json.nil? || config_json.empty?
        raise Informative, "配置未加载,请检查配置文件: #{config_file}"
    end

    if bundle_id.nil? || bundle_id.empty?
        raise Informative, "无法从配置文件中获取 Bundle ID"
    end

    # 创建临时对象来调用模块方法
    tag_helper = Object.new
    tag_helper.extend(Pindo::XcodeAppConfig)

    # 调用封装的方法
    success = tag_helper.create_release_tag(
        project_dir: project_dir,
        config_json: config_json,
        bundle_id: bundle_id,
        delete_tag_name: @delete_tag_name
    )

    unless success
        raise Informative, "创建 tag 失败,请检查日志"
    end
end