From 8f9a7c315416747257b3ef2adfc425c63d85adf8 Mon Sep 17 00:00:00 2001 From: Niall Byrne Date: Wed, 12 May 2021 11:36:14 -0400 Subject: [PATCH] feat(COOKIECUTTER): separate project and galaxy slugs --- .github/template.sh | 2 +- .github/workflows/self-test.yml | 12 ++++++------ cookiecutter.json | 8 +++++--- {{cookiecutter.project_slug}}/meta/main.yml | 4 ++-- .../molecule/docker1/converge.yml | 4 ++-- .../molecule/hostmachine1/converge.yml | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/template.sh b/.github/template.sh index 8990f55b..4597b751 100644 --- a/.github/template.sh +++ b/.github/template.sh @@ -7,7 +7,7 @@ main() { pip install cookiecutter poetry git config --global user.name "${NAME}" git config --global user.email "${EMAIL}" - echo -e '\n\n\n\n\n\n\n' | cookiecutter template/ + echo -e '\n\n\n\n\n\n\n\n\n' | cookiecutter template/ } main diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index ce861e53..41b39523 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -52,7 +52,7 @@ jobs: with: use-quiet-mode: 'no' use-verbose-mode: 'yes' - folder-path: './flower_generator' + folder-path: './flower-generator' max-depth: -1 - name: Report Job Status on Success @@ -92,7 +92,7 @@ jobs: - name: Lint Role Defaults run: | - cd flower_generator + cd flower-generator poetry run molecule lint - name: Report Job Status on Success @@ -134,7 +134,7 @@ jobs: - name: Clean Up Tags for Git Push run: | - cd flower_generator + cd flower-generator git checkout master git tag --delete v0.0.0 # Don't Repush git tag v1.0.0 @@ -144,7 +144,7 @@ jobs: github_token: ${{ secrets.REMOTE_TOKEN }} branch: master tags: false - directory: flower_generator + directory: flower-generator repository: ${{ secrets.REMOTE_ORIGIN }} force: true - name: Push To Test Repository (production) @@ -153,7 +153,7 @@ jobs: github_token: ${{ secrets.REMOTE_TOKEN }} branch: production tags: false - directory: flower_generator + directory: flower-generator repository: ${{ secrets.REMOTE_ORIGIN }} force: true - name: Push To Test Repository (release tag) @@ -162,7 +162,7 @@ jobs: github_token: ${{ secrets.REMOTE_TOKEN }} branch: production tags: true - directory: flower_generator + directory: flower-generator repository: ${{ secrets.REMOTE_ORIGIN }} force: true diff --git a/cookiecutter.json b/cookiecutter.json index aa77dfcd..b4026345 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,9 +1,11 @@ { "project_name": "Flower Generator", - "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}", + "project_slug": "{{ cookiecutter.project_name|slugify }}", + "github_handle": "niall-byrne", + "galaxy_role_slug": "{{ cookiecutter.project_slug.replace('-', '_').replace('.', '_') }}", + "galaxy_namespace_slug": "{{ cookiecutter.github_handle|slugify|replace('-', '_')|replace('.', '_') }}", "description": "Not the baking kind.", "author": "Niall Byrne", "company": "Shared Vision Solutions", - "email": "niall@niallbyrne.ca", - "github_handle": "niall-byrne" + "email": "niall@niallbyrne.ca" } diff --git a/{{cookiecutter.project_slug}}/meta/main.yml b/{{cookiecutter.project_slug}}/meta/main.yml index ce1083a6..aa5c367c 100644 --- a/{{cookiecutter.project_slug}}/meta/main.yml +++ b/{{cookiecutter.project_slug}}/meta/main.yml @@ -1,7 +1,7 @@ --- galaxy_info: - role_name: {{ cookiecutter.project_slug }} - namespace: {{ cookiecutter.github_handle.lower().replace(' ', '_').replace('-', '_') }} + role_name: {{ cookiecutter.galaxy_role_slug }} + namespace: {{ cookiecutter.galaxy_namespace_slug }} author: {{ cookiecutter.author }} description: {{ cookiecutter.description }} company: {{ cookiecutter.company }} diff --git a/{{cookiecutter.project_slug}}/molecule/docker1/converge.yml b/{{cookiecutter.project_slug}}/molecule/docker1/converge.yml index 654a783f..0212ff44 100644 --- a/{{cookiecutter.project_slug}}/molecule/docker1/converge.yml +++ b/{{cookiecutter.project_slug}}/molecule/docker1/converge.yml @@ -5,6 +5,6 @@ vars: test: true tasks: - - name: "Include {{ cookiecutter.github_handle.lower().replace(' ', '_').replace('-', '_') }}.{{ cookiecutter.project_slug }}" + - name: "Include {{ cookiecutter.galaxy_namespace_slug }}.{{ cookiecutter.galaxy_role_slug }}" ansible.builtin.include_role: - name: "{{ cookiecutter.github_handle.lower().replace(' ', '_').replace('-', '_') }}.{{ cookiecutter.project_slug }}" + name: "{{ cookiecutter.galaxy_namespace_slug }}.{{ cookiecutter.galaxy_role_slug }}" diff --git a/{{cookiecutter.project_slug}}/molecule/hostmachine1/converge.yml b/{{cookiecutter.project_slug}}/molecule/hostmachine1/converge.yml index 654a783f..0212ff44 100644 --- a/{{cookiecutter.project_slug}}/molecule/hostmachine1/converge.yml +++ b/{{cookiecutter.project_slug}}/molecule/hostmachine1/converge.yml @@ -5,6 +5,6 @@ vars: test: true tasks: - - name: "Include {{ cookiecutter.github_handle.lower().replace(' ', '_').replace('-', '_') }}.{{ cookiecutter.project_slug }}" + - name: "Include {{ cookiecutter.galaxy_namespace_slug }}.{{ cookiecutter.galaxy_role_slug }}" ansible.builtin.include_role: - name: "{{ cookiecutter.github_handle.lower().replace(' ', '_').replace('-', '_') }}.{{ cookiecutter.project_slug }}" + name: "{{ cookiecutter.galaxy_namespace_slug }}.{{ cookiecutter.galaxy_role_slug }}"