Class: Pindo::Command::Deploy::Reportbug

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

Constant Summary

Constants inherited from Pindo::Command

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

Instance Attribute Summary

Attributes inherited from Pindo::Command

#args_help_flag

Instance Method Summary collapse

Methods inherited from Pindo::Command

options, run

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) ⇒ Reportbug

Returns a new instance of Reportbug.



18
19
20
21
22
# File 'lib/pindo/command/deploy/reportbug.rb', line 18

def initialize(argv)
    @args_bundle_id = argv.shift_argument 
    super
    @additional_args = argv.remainder!
end

Instance Method Details

#runObject



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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/pindo/command/deploy/reportbug.rb', line 34

def run
    
    current=Dir.pwd

    app_config_dir = clong_buildconfig_repo(repo_name: @args_bundle_id)

    bugapp_config_dir = clong_buildconfig_repo(repo_name: pindo_single_config.crash_bundle_id)

    if File.exist?(File.join(bugapp_config_dir, "config.json"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "config.json"))
    end
    if File.exist?(File.join(app_config_dir, "config.json"))
        FileUtils.cp_r(File.join(app_config_dir, "config.json"), File.join(bugapp_config_dir, "config.json"))
    end

    if File.exist?(File.join(bugapp_config_dir, "Podfile.lock"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "Podfile.lock"))
    end
    if File.exist?(File.join(app_config_dir, "Podfile.lock"))
        FileUtils.cp_r(File.join(app_config_dir, "Podfile.lock"), File.join(bugapp_config_dir, "Podfile.lock"))
    end


    if File.exist?(File.join(bugapp_config_dir, "Replaced.json"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "Replaced.json"))
    end
    if File.exist?(File.join(app_config_dir, "Replaced.json"))
        FileUtils.cp_r(File.join(app_config_dir, "Replaced.json"), File.join(bugapp_config_dir, "Replaced.json"))
    end

    if File.exist?(File.join(bugapp_config_dir, "Symash.json"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "Symash.json"))
    end
    if File.exist?(File.join(app_config_dir, "Symash.json"))
        FileUtils.cp_r(File.join(app_config_dir, "Symash.json"), File.join(bugapp_config_dir, "Symash.json"))
    end

    if File.exist?(File.join(bugapp_config_dir, "Backup_MapBundleName.json"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "Backup_MapBundleName.json"))
    end
    if File.exist?(File.join(app_config_dir, "Backup_MapBundleName.json"))
        FileUtils.cp_r(File.join(app_config_dir, "Backup_MapBundleName.json"), File.join(bugapp_config_dir, "Backup_MapBundleName.json"))
    end
    

    if File.exist?(File.join(bugapp_config_dir, "DupMethodCache.json"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "DupMethodCache.json"))
    end
    if File.exist?(File.join(app_config_dir, "DupMethodCache.json"))
        FileUtils.cp_r(File.join(app_config_dir, "DupMethodCache.json"), File.join(bugapp_config_dir, "DupMethodCache.json"))
    end


    if File.exist?(File.join(bugapp_config_dir, "import-sympkg.plist"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "import-sympkg.plist"))
    end
    if File.exist?(File.join(app_config_dir, "import-sympkg.plist"))
        FileUtils.cp_r(File.join(app_config_dir, "import-sympkg.plist"), File.join(bugapp_config_dir, "import-sympkg.plist"))
    end

    if File.exist?(File.join(bugapp_config_dir, "MergeClassFiles"))
        FileUtils.rm_rf(File.join(bugapp_config_dir, "MergeClassFiles"))
    end
    if File.exist?(File.join(app_config_dir, "MergeClassFiles"))
        FileUtils.cp_r(File.join(app_config_dir, "MergeClassFiles"), File.join(bugapp_config_dir, "MergeClassFiles"))
    end
    
    app_config_file = File.join(bugapp_config_dir, "config.json")
    if !app_config_file.empty? && File::exist?(app_config_file)   
        default_config_json=JSON.parse(File.read(app_config_file))
        if !default_config_json.nil?
            
            default_config_json['account_info']['apple_acount_id'] = pindo_single_config.demo_apple_id
            default_config_json['app_info']['app_identifier'] = pindo_single_config.crash_bundle_id
            default_config_json['app_info']['app_identifier_pushcontent'] = pindo_single_config.crash_bundle_id + ".content"
            default_config_json['app_info']['app_identifier_pushservice'] = pindo_single_config.crash_bundle_id + ".service"

            if default_config_json['app_info'] && default_config_json['app_info']['app_identifier_keyboard']
                default_config_json['app_info']['app_identifier_keyboard'] = pindo_single_config.crash_bundle_id + ".keyboard"
            end
            if default_config_json['app_info'] && default_config_json['app_info']['app_identifier_imessage']
                default_config_json['app_info']['app_identifier_imessage'] = pindo_single_config.crash_bundle_id + ".imessage"
            end

            if default_config_json['app_info'] && default_config_json['app_info']['app_group_id']
                default_config_json['app_info']['app_group_id'] = "group." + pindo_single_config.crash_bundle_id
            end

            File.open(app_config_file, "w") do |f|
                f.write(JSON.pretty_generate(default_config_json))
            end
        end
    end

    git_addpush_repo(path:bugapp_config_dir, message:"report bugs #{@args_bundle_id}")

end

#validate!Object



24
25
26
27
28
29
30
31
32
# File 'lib/pindo/command/deploy/reportbug.rb', line 24

def validate!
    super
            
    if @args_bundle_id.nil?
        say "You need input a bundle id"
        @args_bundle_id = ask('Bundle Id : ') || nil
    end
    help! 'You need input a bundle id' if @args_bundle_id.nil? || @args_bundle_id.empty?
end