def __check_apiwebmodule_meta_flag(file_path):
    comm_funcs.print_ok(
        "apiwebmodule ......begin __check_apiwebmodule_meta_flag:" + file_path)
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    print_ok("Done apiwebmodule")
    return True
    pass
Exemple #2
0
def generate_controller_show_file(profile_instance, model_domain):
    comm_funcs.print_ok("begin save to controllers")

    FullPathControllerFile = godroid_helper.get_controller_file_name_full_path(
        profile_instance, model_domain)

    contents_list = comm_funcs.get_file_content_as_list(FullPathControllerFile)

    part_one = __self_call_get_package(contents_list)
    comm_funcs.print_ok("controller part one:" + part_one)
    #---- begin
    part_begin = sub_gene_comm.GoTemplateAutoPartBegin

    part_package_import = __self_call_get_packages_part(
        profile_instance, model_domain)

    part_curd = __self_call_get_CURD_part(profile_instance, model_domain)

    part_auto_empty_test = __self_call_get_auto_empty_test_part(
        profile_instance, model_domain)

    part_end = sub_gene_comm.GoTemplateAutoPartEnd
    #---- end

    part_auto_full = part_begin + "\n" + part_package_import + "\n" + part_curd + "\n" + part_auto_empty_test + "\n" + part_end

    part_custom = __self_call_get_custom_part(contents_list)
    all_file_conent = part_one + "\n" + part_auto_full + "\n" + part_custom
    sub_gene_comm.backup_go_file_in_curr_dir_and_touch_new_one(
        FullPathControllerFile)
    comm_funcs.add_to_exist_file(FullPathControllerFile, all_file_conent)

    pass
Exemple #3
0
def generate_api_file(profile_instance, model_domain):
    """
    first , save contents which outside of meta flag
    then , generate new content 
    third , combine them and generate new file
    """
    FullPathApiFile = godroid_helper.get_api_file_name_full_path(
        profile_instance, model_domain)
    contents_list = comm_funcs.get_file_content_as_list(FullPathApiFile)
    part_one = __self_call_get_package(contents_list)

    comm_funcs.print_ok("api part one:" + part_one)

    part_begin = sub_gene_comm.GoTemplateAutoPartBegin
    part_two = __self_call_get_stands_methods(profile_instance, model_domain)
    #()
    part_three = ""
    #(profile_instance, model_domain)
    part_four = ""
    part_five = ""

    part_end = sub_gene_comm.GoTemplateAutoPartEnd

    part_six = __self_call_get_custom_part(contents_list)
    all_file_conent = part_one + "\n" + part_begin + "\n" + part_two + "\n" + part_three + "\n" + part_four + "\n" + part_five + "\n" + part_end + "\n" + part_six
    sub_gene_comm.backup_go_file_in_curr_dir_and_touch_new_one(FullPathApiFile)
    comm_funcs.print_ok("begin save to api:" + FullPathApiFile)
    comm_funcs.add_to_exist_file(FullPathApiFile, all_file_conent)
    pass
Exemple #4
0
def generate_funcs_of_gorp_file(profile_instance, model_domain):
    FullPathFuncsOfGorpFile = godroid_helper.get_model_funcs_of_gorp_file_name_full_path(
        profile_instance, model_domain)
    contents_list = comm_funcs.get_file_content_as_list(
        FullPathFuncsOfGorpFile)
    part_one = __self_call_get_package(contents_list)
    comm_funcs.print_ok("gorp funcs part one:" + part_one)
    #
    part_begin = sub_gene_comm.GoTemplateAutoPartBegin
    #
    part_two = __self_call_get_import(contents_list, profile_instance,
                                      model_domain)
    part_three = __self_call_get_class_def(contents_list, profile_instance)
    part_four = __self_call_get_func_for_sql_tri_pairs(contents_list,
                                                       profile_instance)
    part_five = __self_call_get_gorp_map(contents_list, profile_instance)
    #
    part_end = sub_gene_comm.GoTemplateAutoPartEnd
    #
    part_six = __self_call_get_custom_part(contents_list)
    all_file_conent = part_one + "\n" + part_begin + "\n" + part_two + "\n" + part_three + "\n" + part_four + "\n" + part_five + "\n" + part_end + "\n" + part_six
    sub_gene_comm.backup_go_file_in_curr_dir_and_touch_new_one(
        FullPathFuncsOfGorpFile)
    comm_funcs.print_ok("begin save to gorp:" + FullPathFuncsOfGorpFile)
    comm_funcs.add_to_exist_file(FullPathFuncsOfGorpFile, all_file_conent)
    pass
Exemple #5
0
def __self_call_generate_model_class_gorp_funcs_and_api(
        instance_profile_obj, model_domain):
    """
    if file exist , check have meta tag
                        if have meta , then replace them
                        if not have meta tag , just give hint and stop
    if not exists , create new 
    """
    #sub_gene_class, sub_gene_funcs_gorp, sub_gene_api
    if not godroid_helper.check_model_funcs_api_meta_flag(
            instance_profile_obj, model_domain):
        comm_funcs.print_error(
            "ERROR: model funcs api meta flag check failed :" +
            instance_profile_obj.ProfileFile)
        sys.exit(1)

    comm_funcs.print_ok("\n\n")
    comm_funcs.print_ok(
        "--- --- --- --- --- --- now begin generate code ... ... ... ... ... ")
    sub_gene_class.generate_model_class_file(instance_profile_obj,
                                             model_domain)
    sub_gene_funcs_gorp.generate_funcs_of_gorp_file(instance_profile_obj,
                                                    model_domain)
    sub_gene_api.generate_api_file(instance_profile_obj, model_domain)
    comm_funcs.print_ok(
        "--- --- --- --- --- --- now begin generate code ... ... ... ... ... end"
    )
    comm_funcs.print_ok("\n\n")
    pass
def check_controller_meta_flag( profile_instance, model_domain ):
    """
    controller have two type :  inline and in module.
    so ...
    """
    comm_funcs.print_ok("begin check controller ")
    domain_controller_instance_full_path = get_domain_controller_instance_full_path(profile_instance, model_domain)
    if not os.path.exists(domain_controller_instance_full_path):
        comm_funcs.print_ok("TIPS")
        comm_funcs.print_ok("...... create for :" + domain_controller_instance_full_path )
        os.makedirs(domain_controller_instance_full_path)
    #comm_funcs.print_error(domain_controller_instance_full_path)

    FullPathControllerFile = get_controller_file_name_full_path(profile_instance, model_domain)

    
    
    #comm_funcs.print_ok(FullPathControllerFile)
    if not os.path.exists(FullPathControllerFile):
        touch_and_create_empty_controller_file(FullPathControllerFile, profile_instance)
    comm_funcs.print_ok(">>>> begin check controller meta flag is valid")
    controller_file_valid = False
    controller_file_valid = sub_gene_controller.__check_controller_meta_flag(FullPathControllerFile)

    # admin file
    FullPathControllerAdminFile = get_controller_admin_file_name_full_path(profile_instance, model_domain)
    if not os.path.exists(FullPathControllerAdminFile):
        touch_and_create_empty_controller_file(FullPathControllerAdminFile, profile_instance)
    controller_file_valid = False
    controller_file_valid = sub_gene_controller.__check_controller_meta_flag(FullPathControllerAdminFile)    
    return True
Exemple #7
0
def check_and_create_model_domain_path(model_domain, gopath):
    """
    check the model domain path 
    if the model domain not exit , sys.exit
    if the sub directories not exits , create them.
    """
    ModelDomainPath = ModelDomainFullPath = gopath + "/src/" + model_domain
    comm_funcs.print_ok("......check_and_create_model_domain_path:" +
                        ModelDomainPath)
    for c in ModelDomainPath:
        pass
        #print c
    if os.path.exists(ModelDomainPath):
        return True
    comm_funcs.print_error("PYTHON ERROR: ModelDomainPath not exist:" +
                           ModelDomainPath)
    sys.exit(1)
def generate_model_class_file(profile_instance, model_domain):
    FullPathModelFile = godroid_helper.get_model_class_file_name_full_path(profile_instance, model_domain)
    contents_list = comm_funcs.get_file_content_as_list( FullPathModelFile )
    part_one = __self_call_get_package(contents_list)
    comm_funcs.print_ok( "class part one:" + part_one )
    #---- begin
    part_begin = sub_gene_comm.GoTemplateAutoPartBegin
    part_two = __self_call_get_table_name_const(contents_list, profile_instance)
    part_three = __self_call_get_class(profile_instance)
    part_four = __self_call_get_GetColumnsMap(profile_instance)
    part_five = __self_call_get_GetGorpRenameMap(profile_instance)
    part_end = sub_gene_comm.GoTemplateAutoPartEnd
    #---- end 
    part_six  = __self_call_get_custom_part(contents_list)
    all_file_conent = part_one + "\n" + part_begin + "\n" + part_two + "\n" + part_three + "\n" + part_four + "\n" + part_five + "\n" + part_end + "\n" + part_six
    sub_gene_comm.backup_go_file_in_curr_dir_and_touch_new_one( FullPathModelFile )
    comm_funcs.add_to_exist_file( FullPathModelFile  , all_file_conent  )
    pass
def check_model_funcs_api_meta_flag( profile_instance, model_domain ):
    #gopath = comm_funcs.get_gopath()
    #model_file_name = get_model_class_file_name( profile_instance )
    #funcs_of_gorp_file_name = get_model_funcs_of_gorp_file_name( profile_instance )
    #api_file_name = get_api_file_name( profile_instance )
    #
    domain_model_instance_full_path = get_domain_model_instance_full_path(profile_instance, model_domain)
    if not os.path.exists( domain_model_instance_full_path ):
        comm_funcs.print_ok("TIPS:")
        comm_funcs.print_ok("......create for :" + domain_model_instance_full_path )
        os.makedirs(domain_model_instance_full_path)
    domain_api_instance_full_path = get_domain_api_instance_full_path(profile_instance, model_domain)
    if not os.path.exists( domain_api_instance_full_path ):
        comm_funcs.print_ok("TIPS:")
        comm_funcs.print_ok("......create for :" + domain_api_instance_full_path )
        os.makedirs(domain_api_instance_full_path)


    FullPathModelFile = get_model_class_file_name_full_path(profile_instance, model_domain)
    FullPathFuncsOfGropFile = get_model_funcs_of_gorp_file_name_full_path(profile_instance, model_domain)
    FullPathApiFile = get_api_file_name_full_path(profile_instance, model_domain)
    if not os.path.exists(FullPathModelFile):
        touch_and_create_empty_file(FullPathModelFile, profile_instance)
    if not os.path.exists(FullPathFuncsOfGropFile) :
        touch_and_create_empty_file(FullPathFuncsOfGropFile, profile_instance)
    if not os.path.exists(FullPathApiFile):
        touch_and_create_empty_file(FullPathApiFile, profile_instance)
    if True:
        comm_funcs.print_ok(">>>> begin check meta flag is valid")
        model_class_valid = False
        funcs_of_gorp_valid = False
        api_file_valid = False
        #
        model_class_valid = sub_gene_class.__check_model_meta_flag(FullPathModelFile)
        funcs_of_gorp_valid = sub_gene_funcs_gorp.__check_funcs_meta_flag(FullPathFuncsOfGropFile)
        api_file_valid = sub_gene_api.__check_api_meta_flag(FullPathApiFile)
        if model_class_valid and funcs_of_gorp_valid and api_file_valid:
            return True
        else:
            comm_funcs.print_error("PYTHON ERROR: check files meta flag valid is false !  EXIT NOW ")
            sys.exit(1)
        pass
    #sub_gene_class, sub_gene_funcs_gorp, sub_gene_api
    return True
Exemple #10
0
def __self_call_generate_controller(instance_profile_obj, model_domain):
    """
    sub_gene_controller.py
    """
    if not godroid_helper.check_controller_meta_flag(instance_profile_obj,
                                                     model_domain):
        comm_funcs.print_error("ERROR: controller meta flag check failed: " +
                               instance_profile_obj.ProfileFile)
        sys.exit(1)

    if len(instance_profile_obj.ControlCalssName) == 0:
        comm_funcs.print_error("Tips:")
        comm_funcs.print_ok("ControlCalssName not exist so return .")
        sys.exit(1)
    comm_funcs.print_ok(
        "X : generate the controller and controller_admin file ")
    #if not godroid_helper.check_controller_meta_flag(instance_profile_obj, model_domain):
    #    comm_funcs.print_error("ERROR: controller meta flag check failed:" + instance_profile_obj.ProfileFile)
    #    sys.exit(1)
    #    pass
    sub_gene_controller.generate_controller_file(instance_profile_obj,
                                                 model_domain)
    pass
Exemple #11
0
def check_api_web_module_meta_flag(profile_instance, model_domain):
    """
    api_web_module
    """
    api_web_module_instance_full_path = get_api_web_module_instance_full_path(profile_instance, model_domain)
    if not os.path.exists( api_web_module_instance_full_path ):
        comm_funcs.print_ok("api_web_module TIPS:")
        comm_funcs.print_ok("......create for :" + api_web_module_instance_full_path )
        os.makedirs(api_web_module_instance_full_path)
    FullPathApiWebModuleFile = get_apiwebmodule_file_name_full_path(profile_instance, model_domain)
    if not os.path.exists(FullPathApiWebModuleFile):
        touch_and_create_apiwebgobbs_file(FullPathApiWebModuleFile, profile_instance)
    comm_funcs.print_ok("GodroidHelper>>>> begin check api_web_module meta flag is valid")
    api_web_module_file_valid = False
    api_web_module_file_valid = sub_gene_api_web_module.__check_apiwebmodule_meta_flag(FullPathApiWebModuleFile)
    print_ok("Done")
    return True
    pass
Exemple #12
0
def check_revel_curd_funcs_meta_flag(profile_instance, model_domain):
    """
    revel_curd_funcs
    revelcurdfuncs
    """
    revel_curd_funcs_instance_full_path = get_revel_curd_funcs_instance_full_path(profile_instance, model_domain)
    if not os.path.exists( revel_curd_funcs_instance_full_path ):
        comm_funcs.print_ok("api_web_module TIPS:")
        comm_funcs.print_ok("......create for :" + revel_curd_funcs_instance_full_path )
        os.makedirs(revel_curd_funcs_instance_full_path)  
    FullPathRevelCurdFuncsFile = get_revelcurdfuncs_file_name_full_path(profile_instance, model_domain) 
    if not os.path.exists(FullPathRevelCurdFuncsFile):
        touch_and_create_revelcurdfuncs_file(FullPathRevelCurdFuncsFile, profile_instance)
    comm_funcs.print_ok(">>>> begin check revel_curd_funcs meta flag is valid")
    revelcurdfuncs_file_valid = False
    revelcurdfuncs_file_valid = sub_gene_revel_curd.__check_revelcurdfuncs_meta_flag(FullPathRevelCurdFuncsFile)
    return True
    pass
Exemple #13
0
def print_ok(line):
    comm_funcs.print_ok("   htmlcurd  :" + line)
Exemple #14
0
        help()
        sys.exit(1)

    profile_file = sys.argv[2]
    model_domain = sys.argv[3]
    generate_components = sys.argv[4]
    sub_gene_comm.check_and_create_model_domain_path(model_domain, gopath)
    InstanceProfilePath = sub_gene_comm.get_full_profile_instance_path(
        profile_file)
    # model_profile/models
    # check is generated
    instance_profile_obj = godroid_helper.get_instance_profile_from_profile_file(
        InstanceProfilePath)
    if len(instance_profile_obj.ControlCalssName) == 0:
        comm_funcs.print_error("Tips:")
        comm_funcs.print_ok("ControlCalssName not exist so return .")
        sys.exit(1)

    #
    if "dev" == run_mode:
        instance_profile_obj.IsDevMode = True
        pass
    elif "prod" == run_mode:
        instance_profile_obj.IsDevMode = False
        pass
    #

    if "module" in generate_components or "all" in generate_components:
        comm_funcs.print_ok(
            "... ... begin convert model cfg file to instance profile")
        godroid_helper.print_profile_instance_obj(
Exemple #15
0
def print_ok(text):
    comm_funcs.print_ok(text)
if __name__ == "__main__":
    if 5 != len(sys.argv):
        comm_funcs.print_error("PYTHON ERROR: argv count not match")
        comm_funcs.print_error("ERROR , EXIT PYTHON")
        sys.exit(1)
    app_type = sys.argv[1]
    instance_name = sys.argv[2]
    direction = sys.argv[3]
    is_check_app_type_and_instance_name = sys.argv[4]
    app_type = app_type.strip()
    instance_name = instance_name.strip()
    if "true" == is_check_app_type_and_instance_name:
        """
        """
        if comm_funcs.check_app_type_and_instance_name(app_type, instance_name):
            comm_funcs.print_ok("check app_type and instance_name OK")
        else:
            comm_funcs.print_error("ERROR: app_type or instance_name not match")
            sys.exit(1)

    print direction
    curr_dir = os.getcwd()
    prebuild_conf_debug_conf_routes_file = curr_dir + "/prebuild-conf/" + app_type + "/local_debug/conf/routes"
    if not os.path.isfile( prebuild_conf_debug_conf_routes_file ):
        comm_funcs.print_error("ERROR: can not find : " + prebuild_conf_debug_conf_routes_file)
        sys.exit(1)
    if not check_routes_file_valid( prebuild_conf_debug_conf_routes_file ):
        comm_funcs.print_error( "ERROR: check self header common_part self_part :" + prebuild_conf_debug_conf_routes_file)
        sys.exit(1)
    prebuild_conf_instance_conf_routes_file =  curr_dir + "/prebuild-conf/" + app_type + "/"+ instance_name +"/conf/routes"
    if not os.path.isfile( prebuild_conf_instance_conf_routes_file ):
Exemple #17
0
def __check_model_meta_flag( file_path ):
    comm_funcs.print_ok("......begin __check_model_meta_flag:" + file_path)
    # if check failed then sys exit
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    return True
def print_ok(text):
    comm_funcs.print_ok(text)
    os.system(  pull_cmd  )

    print_ok( """echo "export PKG_CONFIG_PATH=/usr/local/Cellar/sqlite/3.7.17/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH="/usr/local/Cellar/sqlite/3.7.17/lib/pkgconfig:${PKG_CONFIG_PATH}"
" """ )
    if 4 !=  len(sys.argv):
        print_error(" arguments : app_type and instance_name REMOTE SITE all need assigned ")
        print_error(  "ERROR EXIT PYTHON" )
        sys.exit()
    app_type = sys.argv[1]
    instance_name = sys.argv[2]
    remote_site = sys.argv[3]
    app_type = app_type.strip()
    instance_name = instance_name.strip()
    if comm_funcs.check_app_type_and_instance_name(app_type, instance_name):
        comm_funcs.print_ok("check app_type and instance_name OK")
    else:
        print_error(" app_type or instance_name not match")
        sys.exit(1)
    AppTypeTarFile = app_type + ".tar.gz"
    CurrPath = os.getcwd()
    InstanceAppTypeViewsDir = CurrPath + "/src/" + app_type + "_views/" + instance_name
    if not os.path.exists( InstanceAppTypeViewsDir ):
        print_error("ERROR: InstanceAppTypeViewsDir not exist:"+ InstanceAppTypeViewsDir)
        sys.exit(1)
    PreBuildConfDir = CurrPath + "/prebuild-conf"
    TmpAppTypePreBuildConfDir = PreBuildConfDir + "/" + app_type
    InstancePreBuildConfDir = TmpAppTypePreBuildConfDir  + "/" + instance_name
    comm_funcs.print_ok( "InstancePreBuildConfDir: " + InstancePreBuildConfDir )
    CurrTmpDir = CurrPath + "/tmp"
    
def print_ok(line):
    comm_funcs.print_ok("   revel_curd_funcs  :" + line)
Exemple #21
0
def generate_htmlcurl_show_file(profile_instance, model_domain):

    FullPathApiWebModuleNOFILEJUSTDIR = godroid_helper.get_htmlfunc_instance_full_path(
        profile_instance, model_domain)

    if not os.path.exists(FullPathApiWebModuleNOFILEJUSTDIR):
        comm_funcs.print_ok("api_web_module TIPS:")
        comm_funcs.print_ok("......create for :" +
                            FullPathApiWebModuleNOFILEJUSTDIR)
        os.makedirs(FullPathApiWebModuleNOFILEJUSTDIR)
    else:
        if len(FullPathApiWebModuleNOFILEJUSTDIR) > 0:
            print_error(" remove all html file in dir :" +
                        FullPathApiWebModuleNOFILEJUSTDIR + "/*.html")
            comm_funcs.remove_all_html_files_in_dir(
                FullPathApiWebModuleNOFILEJUSTDIR + "/*.html ")

    print_ok(" generate new ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/new.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_new(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate save new ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/save_new.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_save_new(profile_instance,
                                                 model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate m_new ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/m_new.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_m_new(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate edit ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/edit.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_edit(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate save edit ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/save_edit.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_save_edit(profile_instance,
                                                  model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate show ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/show.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_show(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate m_show ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/m_show.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_m_show(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate delete ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/delete.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_delete(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    #print_ok(" generate save delete ")
    #tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/save_delete.html"
    #sub_gene_comm.touch_new_file( tmp_comm_file )
    #content = __self_call_generate_file_save_delete(profile_instance, model_domain)
    #comm_funcs.add_to_exist_file( tmp_comm_file  , content  )
    print_ok(" generate remove ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/remove.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_remove(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    #print_ok(" generate save remove ")
    #tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/save_remove.html"
    #sub_gene_comm.touch_new_file( tmp_comm_file )
    #content = __self_call_generate_file_save_remove(profile_instance, model_domain)
    #comm_funcs.add_to_exist_file( tmp_comm_file  , content  )
    print_ok(" generate list ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/list.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_list(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate index ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/index.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_index(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    print_ok(" generate m_list ")
    tmp_comm_file = FullPathApiWebModuleNOFILEJUSTDIR + "/m_list.html"
    sub_gene_comm.touch_new_file(tmp_comm_file)
    content = __self_call_generate_file_m_list(profile_instance, model_domain)
    comm_funcs.add_to_exist_file(tmp_comm_file, content)
    pass
Exemple #22
0
def print_ok(line):
    comm_funcs.print_ok("   godroid_helper  :" + line )
Exemple #23
0
def print_ok(line):
    comm_funcs.print_ok("   GENERATOR  :" + line)
Exemple #24
0
def help():
    print "--- --- --- --- --- --- --- HELP --- --- --- --- --- "
    print "argv1:", "profile_file.cfg"
    print "argv2:", "ModelDomain , such as  bar.com foo.com "
    comm_funcs.print_ok(
        "argv3: Generate Content type, such as : module;controller;html ")
Exemple #25
0
def __check_funcs_meta_flag(file_path):
    comm_funcs.print_ok("......begin __check_funcs_meta_flag:" + file_path)
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    return True
import os
sys.setdefaultencoding('utf8')
sys.path.append(os.getcwd())
import subprocess
import shutil
import comm_funcs




if __name__ == "__main__":
    gopath = comm_funcs.get_gopath()
    if 0 == len(gopath):
        comm_funcs.print_error( "ERROR GOPATH not set." )
        sys.exit(1)
    comm_funcs.print_ok( "gopath is :" + gopath )
    files = comm_funcs.listdir_fullpath( gopath )
    for one in files:
        print one
        if not os.path.isfile( one ):
            continue
        if one.endswith(".sh") or one.endswith(".py"):
            os.remove(one)
    self_files = comm_funcs.listdir_fullpath( os.getcwd() )
    for one in self_files:
        print one
        if not os.path.isfile( one ) or  "sync_myself" in one :
            continue
        if one.endswith(".sh") or one.endswith(".py"):
            comm_funcs.print_ok("sync " + one + " to ../ " )
            os.system( "cp " + one + " "  + " ../" )
def print_ok(line):
    comm_funcs.print_ok("   api_web_module  :" + line)
def clean_public_dir_content(TmpInstanceDir, app_type):
    cmd_str = "rm -rf "  + TmpInstanceDir + "/src/gobbs/public/ria/"
    comm_funcs.print_ok("begin remove content : " + cmd_str)
    os.system( cmd_str )
    pass
Exemple #29
0
import time





if __name__ == "__main__":
    """
    """
    if 1 == len(sys.argv):
        comm_funcs.print_error(" push or pull ?")
        sys.exit(1)
    push_or_pull = sys.argv[1]
    if push_or_pull not in "push pull":
        comm_funcs.print_error(" what your input is not match push or pull ")
        sys.exit(1)
    gopath = comm_funcs.get_gopath()
    if gopath is None or 0 == len(gopath):
        comm_funcs.print_error("ERROR: evn path not set , prod mod")
        sys.exit(1)
    auto_gitpush_projs = comm_funcs.get_file_content_as_list(gopath + "/" + "auto_gitpush_projs.txt")
    for one in auto_gitpush_projs:
        one = one.strip()
        if 0 == len(one):
            continue
        comm_funcs.print_ok(" relative path :" + one )
        full_path = "./test_auto_gitpush.sh " + gopath + "/" + one + " " + push_or_pull
        comm_funcs.print_ok("full path:"+full_path)
        os.system( full_path )

Exemple #30
0
sys.setdefaultencoding('utf8')
import os
sys.path.append(os.getcwd())
import subprocess
import shutil
import comm_funcs

import sub_gene_class, sub_gene_funcs_gorp, sub_gene_api, sub_gene_comm, godroid_helper
from docopt import docopt



if "__main__" == __name__:
    arguments = docopt(__doc__, version='0.1.1rc')
    print_ok(arguments)
    comm_funcs.print_ok("begin generate cfg ... ")
    """
    generate the cfg files
    """
    tmplt_name = "zhaopin_person_basic.tmplt"
    bb = "cfg_templates"

    json_content = comm_funcs.get_file_content_as_list( tmplt_name )
    gopath = comm_funcs.check_and_get_go_path()
    #ClassCfgTemplate
    #ClassColumnCfgTemplateProfile
    sub_gene_comm.check_model_profile_exist()
    

"""
"""
 """
 original_sigint = signal.getsignal(signal.SIGINT)
 signal.signal(signal.SIGINT, exit_gracefully)
 #
 #
 #
 comm_funcs.helloworld()
 if 2 >= len(sys.argv):
     print "error, should assign: app_type instance_name "
     sys.exit(1)
 app_type = sys.argv[1]
 instance_name = sys.argv[2]
 app_type = app_type.strip()
 instance_name = instance_name.strip()
 if comm_funcs.check_app_type_and_instance_name(app_type, instance_name):
     comm_funcs.print_ok("check app_type and instance_name OK")
 else:
     comm_funcs.print_error("ERROR: app_type or instance_name not match")
     sys.exit(1)
 #run_program()
 print "export PATH=\"$PATH:$GOPATH/bin\""
 os.system("export PATH=\"$PATH:$GOPATH/bin\"")
 if app_type == "gobbs":
     try:
         os.system("./debug_run.sh " + app_type + " "  + instance_name )
     except KeyboardInterrupt:
         comm_funcs.print_error( "Ctrl+C capture ")
         sys.exit(1)
 if app_type == "martini":
     comm_funcs.print_ok("begin debug_run_martini.sh ")
     try:
Exemple #32
0
    if 5 != len(sys.argv):
        comm_funcs.print_error("PYTHON ERROR: argv count not match")
        comm_funcs.print_error("ERROR , EXIT PYTHON")
        sys.exit(1)
    app_type = sys.argv[1]
    instance_name = sys.argv[2]
    direction = sys.argv[3]
    is_check_app_type_and_instance_name = sys.argv[4]
    app_type = app_type.strip()
    instance_name = instance_name.strip()
    if "true" == is_check_app_type_and_instance_name:
        """
        """
        if comm_funcs.check_app_type_and_instance_name(app_type,
                                                       instance_name):
            comm_funcs.print_ok("check app_type and instance_name OK")
        else:
            comm_funcs.print_error(
                "ERROR: app_type or instance_name not match")
            sys.exit(1)

    print direction
    curr_dir = os.getcwd()
    prebuild_conf_debug_conf_routes_file = curr_dir + "/prebuild-conf/" + app_type + "/local_debug/conf/routes"
    if not os.path.isfile(prebuild_conf_debug_conf_routes_file):
        comm_funcs.print_error("ERROR: can not find : " +
                               prebuild_conf_debug_conf_routes_file)
        sys.exit(1)
    if not check_routes_file_valid(prebuild_conf_debug_conf_routes_file):
        comm_funcs.print_error(
            "ERROR: check self header common_part self_part :" +
Exemple #33
0
def clean_public_dir_content(TmpInstanceDir, app_type):
    cmd_str = "rm -rf " + TmpInstanceDir + "/src/gobbs/public/ria/"
    comm_funcs.print_ok("begin remove content : " + cmd_str)
    os.system(cmd_str)
    pass
Exemple #34
0
        """echo "export PKG_CONFIG_PATH=/usr/local/Cellar/sqlite/3.7.17/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH="/usr/local/Cellar/sqlite/3.7.17/lib/pkgconfig:${PKG_CONFIG_PATH}"
" """)
    if 4 != len(sys.argv):
        print_error(
            " arguments : app_type and instance_name REMOTE SITE all need assigned "
        )
        print_error("ERROR EXIT PYTHON")
        sys.exit()
    app_type = sys.argv[1]
    instance_name = sys.argv[2]
    remote_site = sys.argv[3]
    app_type = app_type.strip()
    instance_name = instance_name.strip()
    if comm_funcs.check_app_type_and_instance_name(app_type, instance_name):
        comm_funcs.print_ok("check app_type and instance_name OK")
    else:
        print_error(" app_type or instance_name not match")
        sys.exit(1)
    AppTypeTarFile = app_type + ".tar.gz"
    CurrPath = os.getcwd()
    InstanceAppTypeViewsDir = CurrPath + "/src/" + app_type + "_views/" + instance_name
    if not os.path.exists(InstanceAppTypeViewsDir):
        print_error("ERROR: InstanceAppTypeViewsDir not exist:" +
                    InstanceAppTypeViewsDir)
        sys.exit(1)
    PreBuildConfDir = CurrPath + "/prebuild-conf"
    TmpAppTypePreBuildConfDir = PreBuildConfDir + "/" + app_type
    InstancePreBuildConfDir = TmpAppTypePreBuildConfDir + "/" + instance_name
    comm_funcs.print_ok("InstancePreBuildConfDir: " + InstancePreBuildConfDir)
    CurrTmpDir = CurrPath + "/tmp"
 """
 original_sigint = signal.getsignal(signal.SIGINT)
 signal.signal(signal.SIGINT, exit_gracefully)
 #
 #
 #
 comm_funcs.helloworld()
 if 2 >= len(sys.argv):
     print "error, should assign: app_type instance_name "
     sys.exit(1)
 app_type = sys.argv[1]
 instance_name = sys.argv[2]
 app_type = app_type.strip()
 instance_name = instance_name.strip()
 if comm_funcs.check_app_type_and_instance_name(app_type, instance_name):
     comm_funcs.print_ok("check app_type and instance_name OK")
 else:
     comm_funcs.print_error("ERROR: app_type or instance_name not match")
     sys.exit(1)
 #run_program()
 print "export PATH=\"$PATH:$GOPATH/bin\""
 os.system("export PATH=\"$PATH:$GOPATH/bin\"")
 if app_type == "gobbs":
     try:
         os.system("./debug_run.sh " + app_type + " " + instance_name)
     except KeyboardInterrupt:
         comm_funcs.print_error("Ctrl+C capture ")
         sys.exit(1)
 if app_type == "martini":
     comm_funcs.print_ok("begin debug_run_martini.sh ")
     try: