예제 #1
0
def transferFls(src,
                dest,
                plat,
                debug,
                mVars,
                mFuns,
                foldersToFollow,
                parents=[]):
    if len(parents) == 0:
        print "Transfering files for " + plat + "..."
    for fil in bash.ls(src):
        fpath = src + "/" + fil
        if bash.isdir(fpath):
            if fil[0] == "_":
                if fil == rawFolder:
                    dpath = dest
                    for parent in parents:
                        dpath += "/" + parent
                        if not bash.exists(dpath):
                            bash.mkdir(dpath)
                    for f in bash.ls(fpath):
                        bash.cp_r(fpath + "/" + f, dpath + "/" + f)
                elif not fil in ignoreFolders:
                    transferLeaf(fpath, dest, plat, debug, mVars, mFuns,
                                 parents, fil in mergeFolders)
            elif fil in foldersToFollow:
                transferFls(fpath, dest, plat, debug, mVars, mFuns, uSet,
                            parents + [fil])
    htmlPath = src + "/" + indexHTML
    if bash.exists(htmlPath):
        transferLeaf(htmlPath, dest, plat, debug, mVars, mFuns, parents, True)
예제 #2
0
파일: build.py 프로젝트: chkex/cx
def compileFolder(path, parents=[]):
    for fil in bash.ls(path):
        fpath = path+"/"+fil;
        if bash.isdir(fpath):
            if not fil in noTemplating:
                compileFolder(fpath, parents+[fil]);
    if bash.isdir(path+"/"+styleFolder):
        bash.cp_r(path+"/"+styleFolder, path+"/"+cssFolder);
        bash.sass(path+"/"+cssFolder, path+"/"+cssFolder);
    if bash.isdir(path+"/"+templateFolder):
        compileWebTemplates(path+"/"+templateFolder, parents);
예제 #3
0
def compileFolder(path, parents=[]):
    for fil in bash.ls(path):
        fpath = path + "/" + fil
        if bash.isdir(fpath):
            if not fil in noTemplating:
                compileFolder(fpath, parents + [fil])
    if bash.isdir(path + "/" + styleFolder):
        bash.cp_r(path + "/" + styleFolder, path + "/" + cssFolder)
        bash.sass(path + "/" + cssFolder, path + "/" + cssFolder)
    if bash.isdir(path + "/" + templateFolder):
        compileWebTemplates(path + "/" + templateFolder, parents)
예제 #4
0
파일: build.py 프로젝트: Check-Please/cx
def compileFolder(path, parents=[]):
    for fil in bash.ls(path):
        fpath = path+"/"+fil;
        if bash.isdir(fpath):
            if not fil in noTemplating:
                compileFolder(fpath, parents+[fil]);
    if bash.isdir(path+"/"+styleFolder):
        bash.cp_r(path+"/"+styleFolder, path+"/"+cssFolder);
        bash.sass(path+"/"+cssFolder, path+"/"+cssFolder);
    if bash.isdir(path+"/"+templateFolder):
        compileWebTemplates(path+"/"+templateFolder, parents);
    if bash.isdir(path+"/_tmplt"): #TODO make a variable for "tmplt" folder
        compileTemplates(path+"/_tmplt", parents);
예제 #5
0
def compileFolder(path, parents=[]):
    for fil in bash.ls(path):
        fpath = path + "/" + fil
        if bash.isdir(fpath):
            if not fil in noTemplating:
                compileFolder(fpath, parents + [fil])
    if bash.isdir(path + "/" + styleFolder):
        bash.cp_r(path + "/" + styleFolder, path + "/" + cssFolder)
        bash.sass(path + "/" + cssFolder, path + "/" + cssFolder)
    if bash.isdir(path + "/" + templateFolder):
        compileWebTemplates(path + "/" + templateFolder, parents)
    if bash.isdir(path + "/_tmplt"):  #TODO make a variable for "tmplt" folder
        compileTemplates(path + "/_tmplt", parents)
예제 #6
0
파일: build.py 프로젝트: chkex/cx
def compileServerOnlyTemplates(src, mVars, mFuns, package=[]):
    tmpPath = src+"/"+tmpFolder;
    if not bash.exists(tmpPath):
        bash.mkdir(tmpPath);
    for fil in bash.ls(src):
        path = src+"/"+fil;
        if bash.isdir(path) and fil != tmpFolder:
            compileServerOnlyTemplates(path, mVars, mFuns, package+[fil]);
        elif fil.endswith(tmpltExt):
            fil = fil[:len(fil)-len(tmpltExt)];
            assert(bash.exists(src+"/"+fil+".tspec"));
            tmpTmplt = tmpPath+"/"+fil+".tmplt"; 
            tmpTspec = tmpPath+"/"+fil+".tspec"; 
            bash.cp_r(src+"/"+fil+".tmplt", tmpTmplt);
            bash.cp_r(src+"/"+fil+".tspec", tmpTspec);
            macros.run(tmpTmplt, mVars, mFuns);
            macros.run(tmpTspec, mVars, mFuns);
            compileTemplateToJava(tmpPath+"/"+fil, package);
    bash.rm_r(tmpPath);
예제 #7
0
def compileServerOnlyTemplates(src, mVars, mFuns, package=[]):
    tmpPath = src + "/" + tmpFolder
    if not bash.exists(tmpPath):
        bash.mkdir(tmpPath)
    for fil in bash.ls(src):
        path = src + "/" + fil
        if bash.isdir(path) and fil != tmpFolder:
            compileServerOnlyTemplates(path, mVars, mFuns, package + [fil])
        elif fil.endswith(tmpltExt):
            fil = fil[:len(fil) - len(tmpltExt)]
            assert (bash.exists(src + "/" + fil + ".tspec"))
            tmpTmplt = tmpPath + "/" + fil + ".tmplt"
            tmpTspec = tmpPath + "/" + fil + ".tspec"
            bash.cp_r(src + "/" + fil + ".tmplt", tmpTmplt)
            bash.cp_r(src + "/" + fil + ".tspec", tmpTspec)
            macros.run(tmpTmplt, mVars, mFuns)
            macros.run(tmpTspec, mVars, mFuns)
            compileTemplateToJava(tmpPath + "/" + fil, package)
    bash.rm_r(tmpPath)
예제 #8
0
파일: build.py 프로젝트: Check-Please/cx
def transferFls(src,dest,plat,debug,mVars,mFuns,foldersToFollow,parents=[]):
    if len(parents) == 0:
        print "Transfering files for "+plat+"..."
    for fil in bash.ls(src):
        fpath = src + "/" + fil;
        if bash.isdir(fpath):
            if fil[0] == "_":
                if fil == rawFolder:
                    dpath = dest;
                    for parent in parents:
                        dpath += "/"+parent;
                        if not bash.exists(dpath):
                            bash.mkdir(dpath);
                    for f in bash.ls(fpath):
                        bash.cp_r(fpath+"/"+f, dpath+"/"+f);
                elif not fil in ignoreFolders:
                    transferLeaf(fpath, dest, plat, debug, mVars, mFuns,
                                            parents, fil in mergeFolders);
            elif fil in foldersToFollow:
                transferFls(fpath, dest, plat, debug, mVars, mFuns, uSet,
                                                            parents+[fil])
    htmlPath = src+"/"+indexHTML;
    if bash.exists(htmlPath):
        transferLeaf(htmlPath,dest,plat,debug,mVars,mFuns,parents,True);
예제 #9
0
파일: build.py 프로젝트: Check-Please/cx
def transferLeaf(src, dest, plat, debug, mVars, mFuns, parents, merge):
    if merge:
        assert(len(parents) > 0);
    isDir = bash.isdir(src)
    wantsMacros = not (isDir and (os.path.basename(src) in noTemplating));
    ext = src[src.rfind("/_")+2:] if isDir else src[src.rfind(".")+1:];
    outPath = dest+("/"+ext if isDir else "");
    for parent in parents:
        if not bash.exists(outPath):
            bash.mkdir(outPath);
        outPath += "/" + parent;
    if not merge and not bash.exists(outPath):
        bash.mkdir(outPath);

    if isDir:
        # Get list of files to transfer 
        baseFolders = ["",  "/_"+plat] + (["/"+debugFolder,
                            "/_"+plat+"/"+debugFolder] if debug else []);

        # Actually transfer
        if merge:
            ofpath = outPath+"."+ext;
            outfil = bash.writefile(ofpath);
            i = 0;
            while i < len(baseFolders):
                baseFolder = src+baseFolders[i];
                if bash.exists(baseFolder):
                    fils = bash.ls(baseFolder);
                    oFil = baseFolder+"/"+orderFile;
                    if bash.exists(oFil):
                        oFilReader = bash.readfile(oFil);
                        o = oFilReader.read().strip().split();
                        oFilReader.close();
                        fils = o+list(set(fils).difference(o));
                    for fil in fils:
                        fname = baseFolder+"/"+fil;
                        if bash.isdir(fname):
                            if fil[0] != '_':
                                baseFolders.insert(i+1, fname[len(src):]);
                        elif fil.endswith("."+ext):
                            infil = bash.readfile(fname);
                            outfil.write(infil.read()+"\n");
                            infil.close()
                i += 1;
            outfil.close();
            if wantsMacros:
                macros.run(ofpath, mVars, mFuns);
            if ext == "js" and not debug:
                print "\tCompressing \""+ofpath+"\"..."
                bash.compressJS(ofpath, (plat != webPlat));
        else:
            for baseFolder in baseFolders:
                baseFolder = src+baseFolder;
                if bash.exists(baseFolder):
                    for fil in bash.ls(baseFolder):
                        fname = baseFolder+"/"+fil;
                        if fil[0] != '_' or not bash.isdir(fname):
                            oPath = outPath+"/"+fil;
                            bash.cp_r(fname, oPath);
                            if wantsMacros:
                                macros.run(oPath, mVars, mFuns);
    else:
        oPath = outPath + ("."+ext if merge else "");
        bash.cp_r(src, oPath);
        if wantsMacros:
            macros.run(oPath, mVars, mFuns);
예제 #10
0
파일: build.py 프로젝트: Check-Please/cx
        javaProjDir+"/war/WEB-INF/web.xml");

mVars, mFuns = macros.load("build/macros");
mVars['TEST'] = "false";
mVars['DEBUG'] = "true" if debug else "false";
mVars['LOCAL'] = "true" if local else "false";
if bash.exists(javaTmpltDir):
    bash.rm_r(javaTmpltDir);
compileServerOnlyTemplates("server/templates", mVars, mFuns);

platforms = ["web", "iOS"];
platformPaths = [javaProjDir+"/war", "iOS/Checkout Express/www"];

if bash.exists(tmpFolder):
    bash.rm_r(tmpFolder);
bash.cp_r("webprojects", tmpFolder);
compileFolder(tmpFolder);
for i in xrange(0, len(platforms)):
    if bash.exists(platformPaths[i]):
        clearFolder(platformPaths[i],
            "server/protected_war.csv" if i == 0 else None)
    else:
        bash.mkdir(platformPaths[i])
    plat = platforms[i];
    native = plat != webPlat;
    path = platformPaths[i];
    mVars['PLATFORM'] = plat;
    mVars['NATIVE'] = "true" if native else "false";
    mVars['SERVER'] = server if native else "";
    mVars['MODERN'] = "true" if (native or 
                                    mVars['TEST'] == "true") else "false";
예제 #11
0
def transferLeaf(src, dest, plat, debug, mVars, mFuns, parents, merge):
    if merge:
        assert (len(parents) > 0)
    isDir = bash.isdir(src)
    wantsMacros = not (isDir and (os.path.basename(src) in noTemplating))
    ext = src[src.rfind("/_") + 2:] if isDir else src[src.rfind(".") + 1:]
    outPath = dest + ("/" + ext if isDir else "")
    for parent in parents:
        if not bash.exists(outPath):
            bash.mkdir(outPath)
        outPath += "/" + parent
    if not merge and not bash.exists(outPath):
        bash.mkdir(outPath)

    if isDir:
        # Get list of files to transfer
        baseFolders = ["", "/_" + plat] + (
            ["/" + debugFolder, "/_" + plat + "/" +
             debugFolder] if debug else [])

        # Actually transfer
        if merge:
            ofpath = outPath + "." + ext
            outfil = bash.writefile(ofpath)
            i = 0
            while i < len(baseFolders):
                baseFolder = src + baseFolders[i]
                if bash.exists(baseFolder):
                    fils = bash.ls(baseFolder)
                    oFil = baseFolder + "/" + orderFile
                    if bash.exists(oFil):
                        oFilReader = bash.readfile(oFil)
                        o = oFilReader.read().strip().split()
                        oFilReader.close()
                        fils = o + list(set(fils).difference(o))
                    for fil in fils:
                        fname = baseFolder + "/" + fil
                        if bash.isdir(fname):
                            if fil[0] != '_':
                                baseFolders.insert(i + 1, fname[len(src):])
                        elif fil.endswith("." + ext):
                            infil = bash.readfile(fname)
                            outfil.write(infil.read() + "\n")
                            infil.close()
                i += 1
            outfil.close()
            if wantsMacros:
                macros.run(ofpath, mVars, mFuns)
            if ext == "js" and not debug:
                print "\tCompressing \"" + ofpath + "\"..."
                bash.compressJS(ofpath, (plat != webPlat))
        else:
            for baseFolder in baseFolders:
                baseFolder = src + baseFolder
                if bash.exists(baseFolder):
                    for fil in bash.ls(baseFolder):
                        fname = baseFolder + "/" + fil
                        if fil[0] != '_' or not bash.isdir(fname):
                            oPath = outPath + "/" + fil
                            bash.cp_r(fname, oPath)
                            if wantsMacros:
                                macros.run(oPath, mVars, mFuns)
    else:
        oPath = outPath + ("." + ext if merge else "")
        bash.cp_r(src, oPath)
        if wantsMacros:
            macros.run(oPath, mVars, mFuns)
예제 #12
0
makeWebXML("server/servlet-list.csv", javaProjDir + "/war/WEB-INF/web.xml")

mVars, mFuns = macros.load("build/macros")
mVars['TEST'] = "false"
mVars['DEBUG'] = "true" if debug else "false"
mVars['LOCAL'] = "true" if local else "false"
if bash.exists(javaTmpltDir):
    bash.rm_r(javaTmpltDir)
compileServerOnlyTemplates("server/templates", mVars, mFuns)

platforms = ["web", "iOS"]
platformPaths = [javaProjDir + "/war", "iOS/Checkout Express/www"]

if bash.exists(tmpFolder):
    bash.rm_r(tmpFolder)
bash.cp_r("webprojects", tmpFolder)
compileFolder(tmpFolder)
for i in xrange(0, len(platforms)):
    if bash.exists(platformPaths[i]):
        clearFolder(platformPaths[i],
                    "server/protected_war.csv" if i == 0 else None)
    else:
        bash.mkdir(platformPaths[i])
    plat = platforms[i]
    native = plat != webPlat
    path = platformPaths[i]
    mVars['PLATFORM'] = plat
    mVars['NATIVE'] = "true" if native else "false"
    mVars['SERVER'] = server if native else ""
    mVars['MODERN'] = "true" if (native
                                 or mVars['TEST'] == "true") else "false"