summaryrefslogtreecommitdiff
path: root/scripts/builder/backendBuilder.py
authorJosh <jokajak@gmail.com>2012-03-17 19:29:33 (UTC)
committer Josh <jokajak@gmail.com>2012-03-17 19:29:33 (UTC)
commit0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33 (patch) (side-by-side diff)
tree2ace8ec32d24c1d34b4578fe9297c4e4b4b97720 /scripts/builder/backendBuilder.py
parentff33328861685c1a2d5f9b729a2b3595509c38ee (diff)
parent6f7ead0446aae6dd9f40b183e402b059a33d0517 (diff)
downloadclipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.zip
clipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.tar.gz
clipperz-0e396afdc4aa9ec8734ba48f90e9fefbad3b2b33.tar.bz2
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scripts/builder/backendBuilder.py') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/builder/backendBuilder.py21
1 files changed, 17 insertions, 4 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
@@ -46,73 +46,86 @@ class BackendBuilder(object):
def frontEndTempFolder (self):
return self.tempFolder()
def developmentTargetFolder (self):
return os.path.join(self.projectTargetDir, 'development', self.relativePath())
def targetFolder (self):
return os.path.join(self.projectTargetDir, self.relativePath())
# --------------------------------------------------------------------------
def writeToFolder (self, folder, filename, content):
file = open(os.path.join(folder, filename), 'w')
file.write(content.encode('utf-8'))
file.close()
def configureIndexContent (self, indexContent, requestPathPrefix = ".."):
result = indexContent
result = result.replace( '@request.path@', requestPathPrefix + '/' + self.settings['request.path'] )
result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] )
return result
def logChecksums (self, content, message):
md5Digest = hashlib.md5(content.encode('utf-8')).hexdigest()
shaDigest = hashlib.sha1(content.encode('utf-8')).hexdigest()
sha256Digest = hashlib.sha256(content.encode('utf-8')).hexdigest()
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)
#===================================================================