Created
April 17, 2014 21:01
-
-
Save rbarros/11011369 to your computer and use it in GitHub Desktop.
Executar php -l em todos os arquivos de um projeto.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import subprocess | |
class ArrayInterator: | |
path = '/var/www/project/' | |
ext = '.php' | |
def step(self, (ext), dirname, names): | |
ext = ext.lower() | |
for name in names: | |
if name.lower().endswith(ext): | |
# Instead of printing, open up the log file for appending | |
self.command(os.path.join(dirname, name)) | |
def command(self, file=None): | |
if file: | |
u'print file' | |
subprocess.call(["php", "-l", file]) | |
else: | |
print "Arquivo nao informado." | |
def __init__(self): | |
os.path.walk(self.path, self.step, (self.ext)) | |
def main(): | |
ArrayInterator() | |
return 0 | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment