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
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
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
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)
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