| Conditions | 2 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # -*- coding: utf-8 -*- |
||
| 11 | @pytest.fixture |
||
| 12 | def hook_shell_script_with_context(tmpdir): |
||
| 13 | script_dir = tmpdir |
||
| 14 | |||
| 15 | if sys.platform.startswith('win'): |
||
| 16 | post_gen_hook_file = script_dir / 'post_gen_project.bat' |
||
| 17 | post_hook_content = textwrap.dedent( |
||
| 18 | u"""\ |
||
| 19 | @echo off |
||
| 20 | |||
| 21 | echo post generation hook |
||
| 22 | echo. >{{cookiecutter.file}} |
||
| 23 | """ |
||
| 24 | ) |
||
| 25 | post_gen_hook_file.write_text(post_hook_content, encoding='utf8') |
||
| 26 | else: |
||
| 27 | post_gen_hook_file = script_dir / 'post_gen_project.sh' |
||
| 28 | post_hook_content = textwrap.dedent( |
||
| 29 | u"""\ |
||
| 30 | #!/bin/bash |
||
| 31 | |||
| 32 | echo 'post generation hook'; |
||
| 33 | touch '{{cookiecutter.file}}' |
||
| 34 | """ |
||
| 35 | ) |
||
| 36 | post_gen_hook_file.write_text(post_hook_content, encoding='utf8') |
||
| 37 | |||
| 38 | return str(post_gen_hook_file) |
||
| 39 | |||
| 56 |