-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(templates): Simplify tap template file names with `post_gen_…
…project.py` hook (#2060) * refactor(templates): simplify file names with `post_gen_project.py` hook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert(templates): undo changes within client files and only keep rename * chore: remove template ci files from `check-yaml` pre-commit hook * refactor(template): simplify folder remove in `post_gen_project.py` by using `shutil.rmtree` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
- Loading branch information
1 parent
206c38e
commit 424e777
Showing
13 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
from pathlib import Path | ||
import shutil | ||
|
||
|
||
BASE_PATH = Path('{{cookiecutter.library_name}}') | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
# Rename stream type client and delete others | ||
target = Path(BASE_PATH, 'client.py') | ||
Path(BASE_PATH, '{{cookiecutter.stream_type|lower}}-client.py').rename(target) | ||
[c.unlink() for c in Path(BASE_PATH).rglob("*-client.py")] | ||
|
||
if '{{ cookiecutter.auth_method }}' not in ('OAuth2', 'JWT'): | ||
Path(BASE_PATH, 'auth.py').unlink() | ||
|
||
if '{{ cookiecutter.stream_type }}' == 'SQL': | ||
Path(BASE_PATH, 'streams.py').unlink() | ||
|
||
if '{{ cookiecutter.license }}' != 'Apache-2.0': | ||
Path('LICENSE').unlink() | ||
|
||
if '{{ cookiecutter.include_ci_files }}' != 'GitHub': | ||
shutil.rmtree(Path('.github')) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.