コード例 #1
0
def convertToLegos(dep):
    modelName = dep.provides.copy().pop()
    if ((re.compile('goog\.cp')).match(modelName) or not (re.compile('goog')).match(modelName)) and not (
            re.compile('^soy')).match(modelName):
        amdCode, modelName = closure2amd.getAmdCodeBySource(dep)
        createRes = legos.createModule(pid='100', name=modelName, title=modelName, desc='', code=amdCode)
        if not createRes:
            legos.saveByModelName(name=modelName, code=amdCode, compressionType='option1')
コード例 #2
0
        return s
    else:
        return unicode(s, encoding)


if __name__ == "__main__":
    logging.basicConfig(format='%(message)s', level=logging.info)
    options, args = _GetOptionsParser().parse_args()
    options_type = options.type

    # legos.saveByModelName('test.test11', '//0012', '59')
    # legos.createModule(pid='59', name='test.test8', title='jinkerTest', desc='desc', code='//code')
    name, code, isTpl = getModelInfo(options.filePath)
    if name:
        if options_type == 'saveModelByPath':
            pid = options.pid
            if not isTpl:
                if pid:
                    legos.createModule(pid=pid,
                                       name=name,
                                       title=name,
                                       desc='',
                                       code=code)
                else:
                    legos.saveByModelName(name=name, code=code, pid=pid)
            else:
                legos.saveTplByModelName(name=name, code=code, pid=pid)
        elif options_type == 'pubIdcModelByPath':
            legos.pubIdcByModuleName(name=name)
    else:
        logging.info("It's not a amd js")
コード例 #3
0
ファイル: legos.py プロジェクト: fordream/tools

def u(s, encoding):
    if isinstance(s, unicode):
        return s
    else:
        return unicode(s, encoding)


if __name__ == "__main__":
    logging.basicConfig(format='%(message)s', level=logging.info)
    options, args = _GetOptionsParser().parse_args()
    options_type = options.type

    # legos.saveByModelName('test.test11', '//0012', '59')
    # legos.createModule(pid='59', name='test.test8', title='jinkerTest', desc='desc', code='//code')
    name, code, isTpl = getModelInfo(options.filePath)
    if name:
        if options_type == 'saveModelByPath':
            pid = options.pid
            if not isTpl:
                if pid:
                    legos.createModule(pid=pid, name=name, title=name, desc='', code=code)
                else:
                    legos.saveByModelName(name=name, code=code, pid=pid)
            else:
                legos.saveTplByModelName(name=name, code=code, pid=pid)
        elif options_type == 'pubIdcModelByPath':
            legos.pubIdcByModuleName(name=name)
    else:
        logging.info("It's not a amd js")