Class: Pindo::Command::Deploy::Tag

Inherits:
Pindo::Command::Deploy show all
Includes:
Pindo::Command::DeployOptions
Defined in:
lib/pindo/command/deploy/tag.rb

Constant Summary

Constants inherited from Pindo::Command

Pindo::Command::DEFAULT_OPTIONS, Pindo::Command::DEFAULT_ROOT_OPTIONS

Instance Attribute Summary

Attributes included from Pindo::Command::DeployOptions

#additional_args, #apple_id, #args_adhoc_flag, #args_appconfig, #args_appconfig_dir, #args_appconfig_fullname, #args_apple_id, #args_appstore_flag, #args_array, #args_bundle_id, #args_dev_flag, #args_repo_name, #argv_temp, #bundle_id, #bundle_id_extension, #bundle_id_extensionad, #bundle_id_extensionporn, #bundle_id_imessage, #bundle_id_keyboard, #bundle_id_pushcontent, #bundle_id_pushservice, #bundle_id_siri, #bundle_id_siriui, #bundle_id_watchapp, #bundle_id_watchapp_extension, #bundle_id_widget, #config_json, #deploy_acount_id, #deploy_group_id, #deploy_icloud_id, #deploy_identifier, #deploy_identifier_extension, #deploy_identifier_extensionad, #deploy_identifier_extensionporn, #deploy_identifier_imessage, #deploy_identifier_keyboard, #deploy_identifier_pushcontent, #deploy_identifier_pushservice, #deploy_identifier_siri, #deploy_identifier_siriui, #deploy_identifier_watchapp, #deploy_identifier_watchapp_extension, #deploy_identifier_widget, #deploy_repo_name, #group_id, #icloud_id, #newconfuse_flag, #oldconfuse_flag

Attributes inherited from Pindo::Command

#args_help_flag

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Pindo::Command::DeployOptions

#check_config_version, #get_build_type_args, #get_bundle_id_map, #get_confuse_type_args, #init_deploy_params, #init_develop_params, #print_params_info, #validate!

Methods inherited from Pindo::Command::Deploy

#get_create_cert_match_values

Methods inherited from Pindo::Command

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

Returns a new instance of Tag.



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

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

Class Method Details

.optionsObject



22
23
24
25
26
# File 'lib/pindo/command/deploy/tag.rb', line 22

def self.options
  [
    ['--d', '删除当前tag']
  ].concat(super)
end

Instance Method Details

#runObject



33
34
35
36
37
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/pindo/command/deploy/tag.rb', line 33

def run

    pindo_new_project_dir = Dir.pwd
    pindo_dir = File::expand_path(pindo_single_config.pindo_dir)
    app_config_dir = File.join(pindo_dir, @deploy_identifier)


    if !@delete_tag_name.nil? 
        result = remove_tag(local_repo_dir:pindo_new_project_dir, tag_name:@delete_tag_name)
        if result
          puts
          puts "代码仓库路径#{pindo_new_project_dir}"
          puts "已删除tag : #{@delete_tag_name}"
          puts
          puts
        end

       result = remove_tag(local_repo_dir:app_config_dir, tag_name:@delete_tag_name)
        if result
          puts
          puts "配置仓库路径#{app_config_dir}"
          puts "已删除tag : #{@delete_tag_name}"
          puts
          puts
        end
    end


    time_str =  Time.now.strftime('%y%m%d') + "_"
    if @config_json && @config_json["app_info"] && @config_json["app_info"]["app_version"]
      temp_version = @config_json["app_info"]["app_version"]
    end 
    tag_name = "ios_release_" + temp_version
    puts tag_name

    remove_tag(local_repo_dir:pindo_new_project_dir, tag_name:tag_name)
    result = add_tag(local_repo_dir:pindo_new_project_dir, tag_name:tag_name)
    if result
      puts
      puts "代码仓库路径#{pindo_new_project_dir}"
      puts "已添加tag : #{tag_name}"
      puts
      puts
    end

    remove_tag(local_repo_dir:app_config_dir, tag_name:tag_name)
    result = add_tag(local_repo_dir:app_config_dir, tag_name:tag_name)

    if result
      puts
      puts "配置仓库路径#{app_config_dir}"
      puts "已添加tag : #{tag_name}"
      puts
      puts
    end

    # branch_name = "branch_"  + temp_version
    # puts branch_name

    # add_branch(local_repo_dir: pindo_new_project_dir, branch: branch_name)
    # git!(%W(-C #{pindo_new_project_dir} checkout master)) 
    # remove_branch(local_repo_dir: pindo_new_project_dir, branch: branch_name)


    
end