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

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Reportbug

Returns a new instance of Reportbug.



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

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

Instance Method Details

#runObject



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
131
132
133
134
135
136
137
138
139
140
# File 'lib/pindo/command/deploy/reportbug.rb', line 44

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



34
35
36
37
38
39
40
41
42
# File 'lib/pindo/command/deploy/reportbug.rb', line 34

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