-rw-r--r-- | scripts/builder/backendBuilder.py | 21 | ||||
-rw-r--r-- | scripts/builder/frontendBuilder.py | 5 | ||||
-rw-r--r-- | scripts/builder/repository.py | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/scripts/builder/backendBuilder.py b/scripts/builder/backendBuilder.py index 3e61955..5b91678 100644 --- a/scripts/builder/backendBuilder.py +++ b/scripts/builder/backendBuilder.py @@ -78,41 +78,54 @@ class BackendBuilder(object): print message + ": " + md5Digest + " (md5)" print message + ": " + shaDigest + " (sha1)" print message + ": " + sha256Digest + " (sha256)" def shouldCompileCode (self): return ('debug' in self.versions) or ('install' in self.versions) def run (self): print self.name() + " - RUN" if self.shouldCompileCode(): self.compileCode() for frontend in self.frontends: + if (frontend.module == frontend.submodule): + submoduleExtension = '' + else: + submoduleExtension = '.' + frontend.submodule + main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) if 'debug' in self.versions: frontend.copyResourcesToFolder(self.frontEndTempFolder()) index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) - self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug.html'), index) + self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug' + submoduleExtension + '.html'), index) if 'install' in self.versions: index = self.configureIndexContent(frontend.assemble()) - self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index.html'), index) + self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) - self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index.html checksum") + self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum") self.createPackage() if 'development' in self.versions: for frontend in self.frontends: + if (frontend.module == frontend.submodule): + submoduleExtension = '' + else: + submoduleExtension = '.' + frontend.submodule + + print "FRONTEND module: " + frontend.module + print "FRONTEND submodule: " + frontend.submodule + main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module)) index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url']) - self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index.html'), index) + self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) #=================================================================== diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index dae837b..1f0f92f 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py @@ -75,33 +75,34 @@ class FrontendBuilder(object): for file in self.filterFiles(files): try: fileHandler = codecs.open(self.absolutePathForSourceFile(basePath, file), 'r', 'utf-8') except: print "FILE: " + file result += fileHandler.read() + '\n' fileHandler.close() return result def template (self): processedFile = 'html_template' if not self.processedFiles.has_key(processedFile): - self.processedFiles[processedFile] = self.loadFilesContent('html', ['index_template.html']) + # self.processedFiles[processedFile] = self.loadFilesContent('html', ['index_template.html']) + self.processedFiles[processedFile] = self.loadFilesContent('html', [self.settings['html.template']]) return self.processedFiles[processedFile] def cssminCompressor (self, css): # package found here: # - http://stackoverflow.com/questions/222581/python-script-for-minifying-css/2396777#2396777 # actual downloaded version: http://pypi.python.org/pypi/cssmin/0.1.4 return cssmin.cssmin(css) def regexCssCompressor (self, css): # http://stackoverflow.com/questions/222581/python-script-for-minifying-css/223689#223689 # remove comments - this will break a lot of hacks :-P css = re.sub( r'\s*/\*\s*\*/', "$$HACK1$$", css ) # preserve IE<6 comment hack @@ -306,33 +307,33 @@ class FrontendBuilder(object): self.processedFiles[processedFile] = result return self.processedFiles[processedFile] def cssTagsForFiles (self, basePath, files): #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) def cssTagForContent (self, content): return '<style type="text/css">' + content + '</style>' def scriptTagsForFiles (self, basePath, files): #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> - return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '"></script>', files)) + return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) def scriptTagForContent (self, content): return '<script>' + content + '</script>' def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): cacheKey = version + "-" + versionType if not self.processedFiles.has_key(cacheKey): result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) self.processedFiles[cacheKey] = result else: result = self.processedFiles[cacheKey] #self.log("# cacheKey:\n" + result) return result diff --git a/scripts/builder/repository.py b/scripts/builder/repository.py index 89db9a5..9da98a2 100644 --- a/scripts/builder/repository.py +++ b/scripts/builder/repository.py @@ -37,37 +37,37 @@ class Repository(object): def version (self): result = self.revision() if self.areTherePendingChanges(): result = '>>> ' + result + ' <<<' # print "VERSION: " + result return result #=================================================================== class GitRepository(Repository): def revision (self): - return repository.refs['HEAD'] + return self.repository.refs['HEAD'] def areTherePendingChanges (self): - return repository.is_dirty() + return self.repository.is_dirty() #=================================================================== class HgRepository(Repository): # http://mercurial.selenic.com/wiki/MercurialApi def revision (self): return 'hg:' + str(self.repository['tip']) def areTherePendingChanges (self): # TODO: FIXME: repository.status() does not report 'unknown(?)' files. :( return not all(map(lambda fileList: len(fileList) == 0, self.repository.status())) |