| Conditions | 2 |
| Total Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 10 | def generate_hook(project_phase): |
||
| 11 | if sys.platform.startswith('win'): |
||
| 12 | hook_extension = 'bat' |
||
| 13 | hook_content = textwrap.dedent( |
||
| 14 | u"""\ |
||
| 15 | @echo off |
||
| 16 | |||
| 17 | echo {} hook |
||
| 18 | echo. >shell_post.txt |
||
| 19 | """.format( |
||
| 20 | project_phase.replace('_', ' '), |
||
| 21 | ) |
||
| 22 | ) |
||
| 23 | else: |
||
| 24 | hook_extension = 'sh' |
||
| 25 | hook_content = textwrap.dedent( |
||
| 26 | u"""\ |
||
| 27 | #!/bin/bash |
||
| 28 | |||
| 29 | echo '{} hook'; |
||
| 30 | touch 'shell_post.txt' |
||
| 31 | """.format( |
||
| 32 | project_phase.replace('_', ' '), |
||
| 33 | ) |
||
| 34 | ) |
||
| 35 | |||
| 36 | hook_filename = '{}.{}'.format( |
||
| 37 | project_phase, |
||
| 38 | hook_extension |
||
| 39 | ) |
||
| 40 | return hook_filename, hook_content |
||
| 41 | |||
| 73 |