Commits

Mikele Gatti committed 173493f

Add clean js file from debug line

  • Participants
  • Parent commits d51c0a5

Comments (0)

Files changed (2)

File Utility/removeLineDebuJsFile.py

+# -*- coding: utf-8 -*-
+"""
+@author: Michele Gatti
+
+Analyze js file, find and remove debug line
+"""
+import fnmatch
+import re
+import os
+import shutil
+
+if __name__ == "__main__":
+
+    for root, dirs, files in os.walk(os.path.normpath("C:\Program Files\Pivotal\ePartner\www\customization")):
+        for f in files:
+            if fnmatch.fnmatch(f, '*.js'):
+                stream = open(os.path.normpath(os.path.join(root, f)), "r")
+                testo = stream.read()
+                stream.close()
+                if len(re.findall(r"(?i)(.*\//DEBUG|.*\// DEBUG)", testo)) > 0:
+                    shutil.move(os.path.normpath(os.path.join(root, f)), os.path.normpath(os.path.join(root, f + ".bk")))
+                    testo = re.sub(r"(?i)(.*\//DEBUG|.*\// DEBUG)", '', testo)
+
+                    stream = open(os.path.normpath(os.path.join(root, f)), "w")
+                    stream.writelines(testo)
+                    stream.close()
+
+    print "End"
+

File Utility/removeLineDebuJsFile.py~

Empty file added.