コード例 #1
0
ファイル: IncludeCompressor.py プロジェクト: hannahp/PyAid
 def compressPath(self, rootPath):
     # First compile any coffee scripts to js files
     if self._compileCoffee:
         try:
             from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
             CoffeescriptBuilder.compileAllOnPath(rootPath, rootPath, True)
             self._log.write('Coffee scripts compiled.')
         except Exception, err:
             self._log.writeError('Failed to compile coffeescript files.', err)
             return False
コード例 #2
0
ファイル: IncludeCompressor.py プロジェクト: hannahp/PyAid
    def compressFile(self, rootPath, directory =None):
        if not self._fileExists(rootPath):
            return False

        if self._compileCoffee:
            try:
                from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
                CoffeescriptBuilder.compileAllOnPath(rootPath, os.path.dirname(rootPath), True)
                self._log.write('Coffeescript compiled.')
            except Exception, err:
                self._log.writeError('Failed to compile coffeescript file.', err)
                return False
コード例 #3
0
ファイル: IncludeCompressor.py プロジェクト: sernst/PyAid
    def compressPath(self, rootPath):
        # First compile any coffee scripts to js files
        if self._compileCoffee:
            try:
                from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
                CoffeescriptBuilder.compileAllOnPath(rootPath, rootPath, True)
                self._log.write('Coffee scripts compiled.')
            except Exception as err:
                self._log.writeError('Failed to compile coffeescript files.', err)
                return False

        FileUtils.walkPath(rootPath, self._compressInFolder, None)
        self._log.write('Compression operation complete.')
        return True
コード例 #4
0
    def compressPath(self, rootPath):
        # First compile any coffee scripts to js files
        if self._compileCoffee:
            try:
                from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
                CoffeescriptBuilder.compileAllOnPath(rootPath, rootPath, True)
                self._log.write('Coffee scripts compiled.')
            except Exception as err:
                self._log.writeError('Failed to compile coffeescript files.',
                                     err)
                return False

        FileUtils.walkPath(rootPath, self._compressInFolder, None)
        self._log.write('Compression operation complete.')
        return True
コード例 #5
0
    def compressFile(self, rootPath, directory=None):
        if not self._fileExists(rootPath):
            return False

        if self._compileCoffee:
            try:
                from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
                CoffeescriptBuilder.compileAllOnPath(rootPath,
                                                     os.path.dirname(rootPath),
                                                     True)
                self._log.write('Coffeescript compiled.')
            except Exception as err:
                self._log.writeError('Failed to compile coffeescript file.',
                                     err)
                return False

        return self._compressFile(rootPath, directory)
コード例 #6
0
    def _createEngineJs(self):
        cb = CoffeescriptBuilder(
            'sflow.api.SFlowApi-exec',
            FileUtils.createPath(StaticFlowEnvironment.rootResourcePath, '..', 'js', isDir=True),
            buildOnly=True)
        target = cb.construct()[0]

        targetFolder = FileUtils.createPath(
                StaticFlowEnvironment.rootResourcePath, 'web', 'js', isDir=True)

        result = SiteProcessUtils.compileCoffeescriptFile(target.assembledPath, targetFolder)
        if result['code']:
            print 'ERROR: Failed compilation of the Static Flow engine'
            print result
            return False

        sourcePath = FileUtils.createPath(targetFolder, target.name + '.js', isFile=True)
        destPath   = FileUtils.createPath(targetFolder, 'engine.js', isFile=True)
        SystemUtils.move(sourcePath, destPath)
        return True