# -*-coding:utf-8-*-
from config import BuildConfig
from shell import Shell
import os
import shutil 

#properties 配置
config = BuildConfig.load_properties("../../gradle.properties")
config['root'] = "../.."
config['jks_path'] = "../../jks"
config['properties'] = "../../gradle.properties"


print(" ")
print("------------- 使用帮助 -----------------")
print("1、编译apk")
print("2、修改包名，版本号+1")
print("3、创建新的签名文件")
print("4、commit & push project")
print("5、pull lib_base & cash_plugin_toolbox")
print("6、commit & push lib_base")
print("8、提交一个渠道包Tag")
print("11、copy apk")

commod = int(input("请输入指令编号："))

#命令
if commod == 2:
    app_name = BuildConfig.new_appid(config['app_name'])
    print(app_name)

elif commod == 3:
    BuildConfig.new_keystore(config)

elif commod == 4:
    Shell.push_project(config)

elif commod == 5:
    Shell.pull_base(config)
    
elif commod == 6:
    Shell.push_base(config)
    
elif commod == 8:
    Shell.push_with_tag(config)

elif commod == 11:
    file_name="%s_%s" % (config['corp_id'], config['app_name'])
    apk_local = "%s/resGuardApks/%s.apk" % (config['root'], file_name)
    apk1 = "/Users/connor/Documents/apks/%s.apk" % file_name
    apk2 = "/Users/connor/Documents/apks/%s/%s.apk" % (file_name, file_name)

    if os.path.exists("/Users/connor/Documents/apks/%s" % file_name):
        shutil.copy(apk_local, apk2)
    else:
        shutil.copy(apk_local, apk1)
    