Guest User

Untitled

a guest
Nov 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. from pathlib import Path
  2. import subprocess
  3.  
  4. CURRENT_DIR = Path('.')
  5.  
  6. projects = sorted([x for x in CURRENT_DIR.iterdir() if x.is_dir()])
  7.  
  8. for project in projects:
  9.  
  10. print('*' * 70)
  11. print(f'Checking project: {project}')
  12. print('*' * 70)
  13.  
  14. git_dir = project / '.git'
  15.  
  16. if not git_dir.exists():
  17. print('Not a git repo. Skipping...')
  18. continue
  19.  
  20. hooks_dir = git_dir / 'hooks'
  21.  
  22. hooks = [x for x in hooks_dir.iterdir() if x.is_file()]
  23. for hook in hooks:
  24. print(f'Removing hook: {hook.name}')
  25. hook.unlink()
  26.  
  27. subprocess.run(['git', 'init'], cwd=project)
Add Comment
Please, Sign In to add comment