author | Clipperz <info@clipperz.com> | 2013-01-09 10:37:39 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-09 10:37:39 (UTC) |
commit | 5996ee475c193f08a713eb53338e4769c2716aa7 (patch) (unidiff) | |
tree | 18947a78d3946635ace383bfc3bacdabda11aafd | |
parent | 813c3245eebfebf9d951e082b9a7473d0116b63a (diff) | |
download | clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.zip clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.tar.gz clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.tar.bz2 |
Fixed build script
Changed the build script in order to replace placeholders even if present multiple times
-rw-r--r-- | scripts/builder/frontendBuilder.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index fc603c4..e52c31e 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py | |||
@@ -247,135 +247,135 @@ class FrontendBuilder(object): | |||
247 | # replacers = [ | 247 | # replacers = [ |
248 | # ('aForm', '_1' ), | 248 | # ('aForm', '_1' ), |
249 | # ('inputFields', '_2' ), | 249 | # ('inputFields', '_2' ), |
250 | # ('passwordFieldsFound','_3' ), | 250 | # ('passwordFieldsFound','_3' ), |
251 | # ('aDocument', '_6' ), | 251 | # ('aDocument', '_6' ), |
252 | # ('aLevel', '_7' ), | 252 | # ('aLevel', '_7' ), |
253 | # # ('result', '_8' ), | 253 | # # ('result', '_8' ), |
254 | # ('documentForms', '_9' ), | 254 | # ('documentForms', '_9' ), |
255 | # ('iFrames', '_c' ), | 255 | # ('iFrames', '_c' ), |
256 | # ('anInputElement', '_d' ), | 256 | # ('anInputElement', '_d' ), |
257 | # ('options', '_f' ), | 257 | # ('options', '_f' ), |
258 | # ('option', '_12'), | 258 | # ('option', '_12'), |
259 | # ('aLoginForm', '_13'), | 259 | # ('aLoginForm', '_13'), |
260 | # # ('action', '_17'), | 260 | # # ('action', '_17'), |
261 | # ('radioValues', '_18'), | 261 | # ('radioValues', '_18'), |
262 | # ('radioValueName', '_19'), | 262 | # ('radioValueName', '_19'), |
263 | # ('inputElement', '_1a'), | 263 | # ('inputElement', '_1a'), |
264 | # ('elementValues', '_1b'), | 264 | # ('elementValues', '_1b'), |
265 | # ('radioValue', '_1c'), | 265 | # ('radioValue', '_1c'), |
266 | # ('values', '_1d'), | 266 | # ('values', '_1d'), |
267 | # ('objtype', '_21'), | 267 | # ('objtype', '_21'), |
268 | # ('useKey', '_27'), | 268 | # ('useKey', '_27'), |
269 | # ('bookmarkletDiv', '_28'), | 269 | # ('bookmarkletDiv', '_28'), |
270 | # ('someParameters', '_29'), | 270 | # ('someParameters', '_29'), |
271 | # ('anException', '_2a'), | 271 | # ('anException', '_2a'), |
272 | # ('newDiv', '_2b'), | 272 | # ('newDiv', '_2b'), |
273 | # ('base_url', '_2c'), | 273 | # ('base_url', '_2c'), |
274 | # ('help_url', '_2d'), | 274 | # ('help_url', '_2d'), |
275 | # ('logo_image_url', '_2e'), | 275 | # ('logo_image_url', '_2e'), |
276 | # ('background_image_url','_2f'), | 276 | # ('background_image_url','_2f'), |
277 | # ('close_image_url', '_30'), | 277 | # ('close_image_url', '_30'), |
278 | # #('bookmarklet_textarea','_31'), | 278 | # #('bookmarklet_textarea','_31'), |
279 | # ('innerHTML', '_32'), | 279 | # ('innerHTML', '_32'), |
280 | # ] | 280 | # ] |
281 | # for replacer in replacers: | 281 | # for replacer in replacers: |
282 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | 282 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) |
283 | 283 | ||
284 | # replacers = [ | 284 | # replacers = [ |
285 | # ('headNode', '_1' ), | 285 | # ('headNode', '_1' ), |
286 | # ('clipperzScriptNode','_2' ), | 286 | # ('clipperzScriptNode','_2' ), |
287 | # ] | 287 | # ] |
288 | # for replacer in replacers: | 288 | # for replacer in replacers: |
289 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | 289 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) |
290 | 290 | ||
291 | # result = re.sub(';', ';\n', result) | 291 | # result = re.sub(';', ';\n', result) |
292 | 292 | ||
293 | return result | 293 | return result |
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | def bookmarklet (self): | 297 | def bookmarklet (self): |
298 | cacheKey = 'bookmarklet' | 298 | cacheKey = 'bookmarklet' |
299 | if not self.processedFiles.has_key(cacheKey): | 299 | if not self.processedFiles.has_key(cacheKey): |
300 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' | 300 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' |
301 | self.processedFiles[cacheKey] = result | 301 | self.processedFiles[cacheKey] = result |
302 | else: | 302 | else: |
303 | result = self.processedFiles[cacheKey] | 303 | result = self.processedFiles[cacheKey] |
304 | 304 | ||
305 | return result | 305 | return result |
306 | 306 | ||
307 | 307 | ||
308 | def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType): | 308 | def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType): |
309 | result = self.template() | 309 | result = self.template() |
310 | 310 | ||
311 | result = result.replace('@page.title@', pageTitle, 1) | 311 | result = result.replace('@page.title@', pageTitle) |
312 | result = result.replace('@copyright@', copyright, 1) | 312 | result = result.replace('@copyright@', copyright) |
313 | result = result.replace('@css@', css, 1) | 313 | result = result.replace('@css@', css) |
314 | #result = result.replace('@bookmarklet@', bookmarklet,1) | 314 | #result = result.replace('@bookmarklet@', bookmarklet) |
315 | result = result.replace('@application.version@', version, 1) | 315 | result = result.replace('@application.version@', version) |
316 | result = result.replace('@application.version.type@', versionType,1) | 316 | result = result.replace('@application.version.type@',versionType) |
317 | result = result.replace('@js_' + jsLoadMode + '@', code, 1) | 317 | result = result.replace('@js_' + jsLoadMode + '@', code) |
318 | 318 | ||
319 | result = re.sub('@js_[^@]+@', '', result) | 319 | result = re.sub('@js_[^@]+@', '', result) |
320 | 320 | ||
321 | return result | 321 | return result |
322 | 322 | ||
323 | 323 | ||
324 | def assembleCopyrightHeader (self): | 324 | def assembleCopyrightHeader (self): |
325 | processedFile = 'copyright' | 325 | processedFile = 'copyright' |
326 | if not self.processedFiles.has_key(processedFile): | 326 | if not self.processedFiles.has_key(processedFile): |
327 | #self.log("assembling copyright header") | 327 | #self.log("assembling copyright header") |
328 | copyrightValues = self.settings['copyright.values'] | 328 | copyrightValues = self.settings['copyright.values'] |
329 | license = self.loadFilesContent('../../properties', ['license.txt']) | 329 | license = self.loadFilesContent('../../properties', ['license.txt']) |
330 | result = self.loadFilesContent('properties', ['creditsAndCopyrights.txt']) | 330 | result = self.loadFilesContent('properties', ['creditsAndCopyrights.txt']) |
331 | 331 | ||
332 | result = re.sub('@clipperz.license@', license, result) | 332 | result = re.sub('@clipperz.license@', license, result) |
333 | for key in copyrightValues: | 333 | for key in copyrightValues: |
334 | result = re.sub('@'+key+'@', copyrightValues[key], result) | 334 | result = re.sub('@'+key+'@', copyrightValues[key], result) |
335 | 335 | ||
336 | self.processedFiles[processedFile] = result | 336 | self.processedFiles[processedFile] = result |
337 | 337 | ||
338 | return self.processedFiles[processedFile] | 338 | return self.processedFiles[processedFile] |
339 | 339 | ||
340 | 340 | ||
341 | def cssTagsForFiles (self, basePath, files): | 341 | def cssTagsForFiles (self, basePath, files): |
342 | #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> | 342 | #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> |
343 | return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) | 343 | return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) |
344 | 344 | ||
345 | 345 | ||
346 | def cssTagForContent (self, content): | 346 | def cssTagForContent (self, content): |
347 | return '<style type="text/css">' + content + '</style>' | 347 | return '<style type="text/css">' + content + '</style>' |
348 | 348 | ||
349 | 349 | ||
350 | def scriptTagsForFiles (self, basePath, files): | 350 | def scriptTagsForFiles (self, basePath, files): |
351 | #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> | 351 | #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> |
352 | return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) | 352 | return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) |
353 | 353 | ||
354 | 354 | ||
355 | def scriptTagForContent (self, content): | 355 | def scriptTagForContent (self, content): |
356 | return '<script>' + content + '</script>' | 356 | return '<script>' + content + '</script>' |
357 | 357 | ||
358 | 358 | ||
359 | def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): | 359 | def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): |
360 | cacheKey = version + "-" + versionType | 360 | cacheKey = version + "-" + versionType |
361 | if not self.processedFiles.has_key(cacheKey): | 361 | if not self.processedFiles.has_key(cacheKey): |
362 | result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) | 362 | result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) |
363 | self.processedFiles[cacheKey] = result | 363 | self.processedFiles[cacheKey] = result |
364 | else: | 364 | else: |
365 | result = self.processedFiles[cacheKey] | 365 | result = self.processedFiles[cacheKey] |
366 | 366 | ||
367 | #self.log("# cacheKey:\n" + result) | 367 | #self.log("# cacheKey:\n" + result) |
368 | return result | 368 | return result |
369 | 369 | ||
370 | 370 | ||
371 | def assemble (self, assemblyMode='INSTALL', versionType='LIVE'): | 371 | def assemble (self, assemblyMode='INSTALL', versionType='LIVE'): |
372 | 372 | ||
373 | if versionType == 'LIVE': | 373 | if versionType == 'LIVE': |
374 | pageTitle = "Clipperz - " + self.module | 374 | pageTitle = "Clipperz - " + self.module |
375 | else: | 375 | else: |
376 | pageTitle = "Clipperz - " + self.module + " [" + versionType + " - " + assemblyMode +"]" | 376 | pageTitle = "Clipperz - " + self.module + " [" + versionType + " - " + assemblyMode +"]" |
377 | 377 | ||
378 | if assemblyMode == 'INSTALL': | 378 | if assemblyMode == 'INSTALL': |
379 | copyright = self.assembleCopyrightHeader() | 379 | copyright = self.assembleCopyrightHeader() |
380 | css =self.cssTagForContent(self.compressCSS(self.loadFilesContent('css', self.settings['css']))) | 380 | css =self.cssTagForContent(self.compressCSS(self.loadFilesContent('css', self.settings['css']))) |
381 | js =self.scriptTagForContent( | 381 | js =self.scriptTagForContent( |