Class: Pindo::Command::Utils::Boss

Inherits:
Pindo::Command::Utils show all
Defined in:
lib/pindo/command/utils/boss.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

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

Returns a new instance of Boss.



35
36
37
38
39
40
41
42
43
44
# File 'lib/pindo/command/utils/boss.rb', line 35

def initialize(argv)

    @platform = argv.option('platform')
    @bundleid = argv.option('bundleid')
    @appversion = argv.option('appversion')
    @apptype = argv.option('apptype') || "FunnyApp"

    super(argv)
    @additional_args = argv.remainder!
end

Class Method Details

.get_config(boss_client: nil, app_version: nil, bundle_id: nil, platform: nil) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/pindo/command/utils/boss.rb', line 156

def self.get_config(boss_client:nil, app_version:nil, bundle_id:nil, platform:nil)

    puts 
    puts 
    puts "  bundle_id:#{bundle_id}"
    puts "  app_version:#{app_version}"
    puts "  platform:#{platform}"
    puts "  Base Url:#{boss_client.base_url}"
    puts "  App Type:#{boss_client.app_type}"
    puts 
    puts 

    app_info_dict = {
      app_version:"",
      bundle_id:"",
      platform:"",
      api_version:"1.0",
      apps_flyer_info:{},
      login_device_id: "",
      device_info:{}
    }

    

    device_info = boss_client.get_default_device_info
    # puts device_info
    app_info_dict[:login_device_id] = device_info.device_id
    app_info_dict[:device_info] = device_info
    app_info_dict[:apps_flyer_info] = boss_client.get_default_device_info


    app_info_dict[:app_version] = app_version || "1.0.0"
    app_info_dict[:bundle_id] = bundle_id || "com.heroneverdie101.fancyapp"
    app_info_dict[:platform] = platform || "iOS_Funny_Release"


    data_json =  boss_client.refresh_setting(app_info_dict:app_info_dict)

    return data_json

end

.optionsObject



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

def self.options
  [
    ['--platform', '设置平台号: --platform=\"iOS_Test\"'],
    ['--bundleid', '设置bundle id: --bundleid=\"your url\"'],
    ['--appversion', '设置app的版本号: --appversion=\"1.0.0\"'],
    ['--apptype', '设置app的类型, 默认是FancyApp,属于个性化类型: --apptype=\"FancyApp\"'],
    
  ].concat(super)
end

Instance Method Details

#runObject



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
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/pindo/command/utils/boss.rb', line 51

def run


    # app_info_dict = {
    #   app_version:"",
    #   bundle_id:"",
    #   platform:"",
    #   api_version:"1.0",
    #   apps_flyer_info:{},
    #   login_device_id: "",
    #   device_info:{}
    # }

    # @boss_client = BossClient.new(app_type:"FancyApp", is_dev:false)

    # device_info = @boss_client.get_default_device_info
    # # puts device_info
    # app_info_dict[:login_device_id] = device_info.device_id
    # app_info_dict[:device_info] = device_info
    # app_info_dict[:apps_flyer_info] = @boss_client.get_default_device_info



    # app_version = "1.0.0"
    # bundle_id = "com.heroneverdie101.fancyapp"
    # platform = "iOS_Funny_Release"

    # app_info_dict[:app_version] = app_version || "1.0.0"
    # app_info_dict[:bundle_id] = bundle_id || "com.heroneverdie101.fancyapp"
    # app_info_dict[:platform] = platform || "iOS_Funny_Release"


    # data_json =  @boss_client.refresh_setting(app_info_dict:app_info_dict)

    # if !data_json["data"].nil? 
    #     puts JSON.pretty_generate(data_json["data"])   
    # else
    #     puts JSON.pretty_generate(data_json)   
    # end

    @appconfig_file = './config.json'
    @appconfig_file=File::expand_path(@appconfig_file)

    base_url = nil
    if File.exist?(@appconfig_file)
        current_config_json=JSON.parse(File.read(@appconfig_file))
        
        if @apptype.nil?
            @apptype = current_config_json["project_info"]["app_type"]
        end

        if @appversion.nil?
            @appversion = current_config_json["app_info"]["app_version"]
        end

        if @bundleid.nil?
            @bundleid = current_config_json["app_info"]["app_identifier"]
        end

        if @platform.nil?
            @platform = current_config_json["app_setting"]["kGUKeyAppPlatform"]
        end
        
        if base_url.nil?
            base_url = current_config_json["app_setting"]["kGUKeyAppClientHost"]
        end
    end

    app_version = @appversion || "1.0.0"
    bundle_id = @bundleid || "com.heroneverdie101.fancyapp"
    platform = @platform || "iOS_Funny_Release"
    apptype = @apptype || "FunnyApp"

    boss_client = BossClient.new(app_type:apptype, is_dev:false, base_url:base_url)
    data_json =  Boss::get_config(boss_client:boss_client, app_version:app_version, bundle_id:bundle_id, platform:platform)

    if !data_json["data"].nil? 
        puts JSON.pretty_generate(data_json["data"])   
    else
        puts JSON.pretty_generate(data_json)   
    end


    is_in_review_status = BossClient::is_in_review_status_with_confirm_key(confirm_key:data_json["data"]["confirm_key"])
    puts 
    puts 
    puts "  bundle_id:#{bundle_id}"
    puts "  app_version:#{app_version}"
    puts "  platform:#{platform}"
    puts "  Base Url:#{boss_client.base_url}"
    puts "  App Type:#{boss_client.app_type}"
    puts 

    if is_in_review_status
        puts "  当前设备,当前参数是审核状态".bold.yellow
    else
        puts "  当前设备,当前参数是非审核状态".bold.blue
    end
    puts
    puts 


end

#validate!Object



46
47
48
49
# File 'lib/pindo/command/utils/boss.rb', line 46

def validate!

    super
end