blob: 512d12e0e6f5d666ab56ab893fe45e8bedaf0b22 [file] [log] [blame]
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +05301import os
2
3def replace_code(old, new):
4 txt = os.popen("""grep "%s" ./*/*/*/*.js""" % old).read().split()
5 txt = [t.split(':')[0] for t in txt]
6 txt = list(set(filter(lambda t: t.startswith('./'), txt)))
7 for t in txt:
8 if new:
9 code = open(t,'r').read().replace(old, new)
10 open(t, 'w').write(code)
11 print "Replaced for %s" % t
12 else:
13 print 'Found in %s' % t
14
15if __name__=='__main__':
16 old = """\.button("""
17 new = ""
18 replace_code(old, new)
19