(project_name)
create scaffold with specified project name.
create scaffold with specified project name.
create scaffold with specified project name .
def create_scaffold(project_name):
    """ create scaffold with specified project name.
    """
    if os.path.isdir(project_name):
        logger.log_warning(u"Folder {} exists, please specify a new folder name.".format(project_name))
        return

    logger.color_print("Start to create new project: {}".format(project_name), "GREEN")
    logger.color_print("CWD: {}\n".format(os.getcwd()), "BLUE")

    def create_path(path, ptype):
        if ptype == "folder":
            os.makedirs(path)
        elif ptype == "file":
            open(path, 'w').close()

        msg = "created {}: {}".format(ptype, path)
        logger.color_print(msg, "BLUE")

    path_list = [
        (project_name, "folder"),
        (os.path.join(project_name, "api"), "folder"),
        (os.path.join(project_name, "testcases"), "folder"),
        (os.path.join(project_name, "testsuites"), "folder"),
        (os.path.join(project_name, "reports"), "folder"),
        (os.path.join(project_name, "debugtalk.py"), "file"),
        (os.path.join(project_name, ".env"), "file")
    ]
    [create_path(p[0], p[1]) for p in path_list]

    # create .gitignore file
    ignore_file = os.path.join(project_name, ".gitignore")
    ignore_content = ".env\nreports/*"
    with open(ignore_file, "w") as f:
        f.write(ignore_content)
def create_scaffold ( project_name ) : if os . path . isdir ( project_name ) : logger . log_warning ( u"Folder {} exists, please specify a new folder name." . format ( project_name ) ) return logger . color_print ( "Start to create new project: {}" . format ( project_name ) , "GREEN" ) logger . color_print ( "CWD: {}\n" . format ( os . getcwd ( ) ) , "BLUE" ) def create_path ( path , ptype ) : if ptype == "folder" : os . makedirs ( path ) elif ptype == "file" : open ( path , 'w' ) . close ( ) msg = "created {}: {}" . format ( ptype , path ) logger . color_print ( msg , "BLUE" ) path_list = [ ( project_name , "folder" ) , ( os . path . join ( project_name , "api" ) , "folder" ) , ( os . path . join ( project_name , "testcases" ) , "folder" ) , ( os . path . join ( project_name , "testsuites" ) , "folder" ) , ( os . path . join ( project_name , "reports" ) , "folder" ) , ( os . path . join ( project_name , "debugtalk.py" ) , "file" ) , ( os . path . join ( project_name , ".env" ) , "file" ) ] [ create_path ( p [ 0 ] , p [ 1 ] ) for p in path_list ] # create .gitignore file ignore_file = os . path . join ( project_name , ".gitignore" ) ignore_content = ".env\nreports/*" with open ( ignore_file , "w" ) as f : f . write ( ignore_content )