From 8d3019b42893c971af0cadfe3352a30c9133e77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20G=C3=B3mez-Caldito?= Date: Tue, 6 Oct 2020 14:08:19 +0200 Subject: [PATCH 1/2] #15 Add pipenv wrapper --- CHANGELOG.md | 1 + README.md | 6 ++---- hooks/post_gen_project.py | 2 +- test.sh | 5 +++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 618b6f0..a5723bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch - *[#16](https://github.com/idealista/cookiecutter-ansible-role/issues/16) Remove debian jessie support* @pablogcaldito ### Added +- *[#15](https://github.com/idealista/cookiecutter-ansible-role/issues/15) Add pipenv wrapper* @pablogcaldito - * Add boilerplate README.md* @vicsufer ## [1.0.1](https://github.com/idealista/cookiecutter-ansible-role/tree/1.0.1) (2020-09-17) diff --git a/README.md b/README.md index fec81c2..cc356e7 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,11 @@ This cookiecutter: ### Prerequisities -Cookiecutter version 1.7.x installed. - -You can satify this requirement with ```pip install cookiecutter``` +You just need to have pipenv installed. ## Usage -To generate your ansible role type ```cookiecutter https://github.com/idealista/cookiecutter-ansible-role```. +To generate your ansible role type ```printf "cookiecutter==1.7.2\nJinja2==2.11.2" > requirements.txt && pipenv install -r requirements.txt && pipenv run cookiecutter https://github.com/idealista/cookiecutter-ansible-role && rm Pipfile* requirements.txt```. Then, introduce some parameters needed for generating it. diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 7748edf..f0e20c4 100755 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -36,7 +36,7 @@ def configureRole(): os.remove("files/.empty") def generatePipfile(): - os.system("pipenv install -r test-requirements.txt --three") + print("Now cd into the role directory and introduce the following command for it to be ready: \"pipenv install -r test-requirements.txt --three\"") def main(): checkInput() diff --git a/test.sh b/test.sh index 7b4a01f..ca19a0c 100755 --- a/test.sh +++ b/test.sh @@ -3,7 +3,7 @@ set -e # Generate role -cookiecutter . --no-input app_name="github_cli" exec_name="gh" author="John Doe" min_ansible_version="2.2" ansible_version="2.8.6" molecule_version="3.0.1" python_docker_version="4.1.0" ansible_lint_version="4.2.0" has_service="False" has_files="False" has_handlers="False" has_templates="False" +printf "cookiecutter==1.7.2\nJinja2==2.11.2" > requirements.txt && pipenv install -r requirements.txt && pipenv run cookiecutter . --no-input app_name="github_cli" exec_name="gh" author="John Doe" min_ansible_version="2.2" ansible_version="2.8.6" molecule_version="3.0.1" python_docker_version="4.1.0" ansible_lint_version="4.2.0" has_service="False" has_files="False" has_handlers="False" has_templates="False" && rm Pipfile* requirements.txt ( # Adjust the role to test cd github_cli_role @@ -12,8 +12,9 @@ cookiecutter . --no-input app_name="github_cli" exec_name="gh" author="John Doe" sed -i 's/1.0.0/0.6.4/g' defaults/main.yml sed -i 's/exampleapplication/gh/g' defaults/main.yml # Launch molecule tests - pipenv sync + pipenv install -r test-requirements.txt --three pipenv run molecule test + ) # Cleanup rm -rf github_cli_role From 56f671ec1e039c7fed9057d75345ac75ccd42af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20G=C3=B3mez-Caldito?= Date: Tue, 13 Oct 2020 11:35:16 +0200 Subject: [PATCH 2/2] #15 Add pipenv link in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc356e7..d2d88ad 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This cookiecutter: ### Prerequisities -You just need to have pipenv installed. +You just need to have [pipenv](https://github.com/pypa/pipenv) installed. ## Usage