git.py 486 B

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. from .__load__ import *
  3. # git实时更新
  4. class Git(object):
  5. def __init__(self):
  6. self.share = '/share/lib/'
  7. self.web = self.share + 'web/'
  8. def update(self):
  9. path = self.web
  10. files = File.getFiles(path)
  11. if files:
  12. for i in files:
  13. file = path + i + '/.git/'
  14. if File.exists(file):
  15. self.pull(path, i, file)
  16. def pull(self, path, name, file):
  17. path = path + name + '/'
  18. Shell.popen('cd ' + path + ' && git pull')