Skip to content

Commit c493d95

Browse files
authored
Merge pull request #12 from ferreteleco/feature/upgrade-hooks
Feature/upgrade hooks
2 parents 09b802e + d58a896 commit c493d95

File tree

3 files changed

+52
-13
lines changed

3 files changed

+52
-13
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
2424

2525
-
2626

27+
## [**1.2.1**] - 2023-03-13
28+
29+
### Added
30+
31+
-
32+
33+
### Changed
34+
35+
- Improved post gen. hooks, now tells to look for the checklist associated with each action.
36+
- Improved existing documentation to reflect changes and better explain functionality.
37+
38+
### Fixed
39+
40+
- Minor errors in C++ CI UT template.
41+
2742
## [**1.1.0**] - 2023-03-13
2843

2944
### Added

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repository can be used for adding Github Actions and templates to an existi
44

55
## Version
66

7-
Current version is 1.2.0 and was set according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
Current version is 1.2.1 and was set according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

99
Project's version should be updated, when applicable:
1010

@@ -23,16 +23,16 @@ $ cookiecutter https://github.com/ferreteleco/cookie-github.git
2323
It will create the appropriate .github folder in your project directory (wherever you invoke
2424
cookiecutter).
2525

26-
NOTE: it can also be cloned using GIT over SSH, if properly configured in your account.
26+
**NOTE:** it can also be cloned using GIT over SSH, if properly configured in your account.
2727

28-
NOTE1: after the repository is downloaded, the template can be used again without downloading it
28+
**NOTE:** after the repository is downloaded, the template can be used again without downloading it
2929
again. In order to do so, simply specify template name as argument for cookiecutter:
3030

3131
```bash
3232
$ cookiecutter cookie-github
3333
```
3434

35-
NOTE: alternatively, you can use [Cookieninja](https://github.com/cookieninja-generator/cookieninja),
35+
**NOTE:** alternatively, you can use [Cookieninja](https://github.com/cookieninja-generator/cookieninja),
3636
forked and more updated version of Cookiecutter with backward compatibility.
3737

3838
## Variables
@@ -53,6 +53,9 @@ you will be prompted to fill in the following values:
5353
project built with Poetry.
5454
- other, which does not generate any action.
5555

56+
**NOTE:** Each added action will be accompanied of a markdown checklist, stating the changes /
57+
configuration required to fine tune it.
58+
5659
## Contributing
5760

5861
If you want to contribute to this template, feel free to do so! Create a new branch to work in, and

hooks/post_gen_project.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55
from shutil import rmtree, copytree
66

77

8+
class color:
9+
"""Simple colors for print without external libraries."""
10+
PURPLE = '\033[95m'
11+
CYAN = '\033[96m'
12+
DARK_CYAN = '\033[36m'
13+
BLUE = '\033[94m'
14+
GREEN = '\033[92m'
15+
YELLOW = '\033[93m'
16+
RED = '\033[91m'
17+
BOLD = '\033[1m'
18+
UNDERLINE = '\033[4m'
19+
END = '\033[0m'
20+
21+
822
def change_line_endings_crlf_to_lf():
923
for path in Path(".").glob("**/*"):
1024
if path.is_file():
@@ -31,20 +45,27 @@ def add_ci_action_unit_tests_runner():
3145

3246
target_language = "{{cookiecutter.project_language}}"
3347

34-
if {{cookiecutter.add_ci_action_unit_tests_runner}} and target_language.lower() != "other":
48+
if {{cookiecutter.add_ci_action_unit_tests_runner}}:
49+
50+
if target_language.lower() != "other":
51+
52+
LOG.info("Adding action for running unit tests (workflows folder) with default config...")
3553

36-
LOG.info("Adding action for running unit tests (workflows folder) with default config...")
54+
destination = Path("workflows")
55+
ci_test_workflow_files_path = Path("_", "workflows", target_language)
56+
copytree(ci_test_workflow_files_path, destination)
3757

38-
destination = Path("workflows")
39-
ci_test_workflow_files_path = Path("_", "workflows", target_language)
40-
copytree(ci_test_workflow_files_path, destination)
58+
print("\n\n######################################################################")
59+
print("# #")
60+
print(f"# {color.BOLD}{color.BLUE}Please review gen. checklist in order to adjust CI UT basic action{color.END} #")
61+
print("# #")
62+
print("######################################################################\n\n")
4163

42-
print("\n\n#################################################################")
43-
print("# Please check gen. checklist in order to adjust CI UT basic action #")
44-
print("#################################################################\n\n")
64+
else:
65+
LOG.info("CI action for running unit tests file generation is not defined for %s language. Skipping...", target_language)
4566

4667
else:
47-
LOG.info("Skipping CI action for running unit tests file generation (%s language selected) ...", target_language)
68+
LOG.info("Skipping CI action for running unit tests file generation")
4869

4970

5071
def clean():

0 commit comments

Comments
 (0)