Skip to content

Commit

Permalink
style: align the format
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Aug 13, 2024
1 parent 0c8d62d commit 7d7f38f
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 68 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/template_inputs_cxx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
default_context:
full_name: X Author Name
email: [email protected]
github_username: x-pt
project_name: My Awesome Project
project_slug: my-awesome-project
package_name: my_awesome_project
project_desc: A nice cxx project
cxx_cmake_version: "3.28"
cxx_standard_version: 20
cxx_standard_required: true
cxx_extensions_required: false
cxx_project_type: [ "binary", "library" ]
cxx_share_enabled: false
20 changes: 0 additions & 20 deletions .github/workflows/template_values.toml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# X Project Template

A template for [cargo generate](https://github.com/cargo-generate/cargo-generate)
A template using [CookieCutter](https://github.com/cookiecutter/cookiecutter)
that aims to be a starting point suitable for
the vast majority of startup projects that will be hosted on GitHub.

Expand Down
32 changes: 18 additions & 14 deletions template/cxx/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
{
"project_name": "My Awesome Project",
"project_slug": "{{ cookiecutter.project_name | trim | slugify }}",
"project_slug": "{{ cookiecutter.project_name | slugify }}",
"package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}",
"cmake_min_version": "3.28",
"project_desc": "A nice cxx project",
"full_name": "Firstname Lastname",
"email": "[email protected]",
"github_username": "your-org-or-username",


"cxx_cmake_version": "3.28",
"cxx_standard_version": "20",
"cxx_standard_required": true,
"cxx_extensions_required": false,
"project_type": ["binary", "library"],
"is_shared": false,
"short_description": "A nice cxx project",
"github_username": "your-org-or-username",
"full_name": "Firstname Lastname",
"email": "[email protected]",
"cxx_project_type": ["binary", "library"],
"cxx_share_enabled": false,


"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}",
"__prompts__": {
"project_name": "Select your project name",
"project_slug": "Project slug",
"package_name": "Package name",
"short_description": "Short description",
"project_name": "Enter your project name",
"project_slug": "Generated project identifier (slug)",
"package_name": "Generated package/module name",
"project_desc": "Brief project description",
"github_username": "GitHub username or organization",
"full_name": "Author full name",
"email": "Author email"
"full_name": "Author's full name",
"email": "Author's email address"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
password: {{ "${{ secrets.GITHUB_TOKEN }}" }}
-
name: Build and Export to Docker
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand All @@ -41,7 +41,7 @@ jobs:
docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1}
-
name: Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
6 changes: 3 additions & 3 deletions template/cxx/{{cookiecutter.project_slug}}/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION {{cookiecutter.cmake_min_version}})
cmake_minimum_required(VERSION {{cookiecutter.cxx_cmake_version}})
project({{cookiecutter.project_slug}} LANGUAGES CXX)

# C++ Standard settings
Expand All @@ -23,8 +23,8 @@ if(NOT MSVC)
endif()

# Determine target type
set(IS_BINARY {{ cookiecutter.project_type == "binary" }})
set(IS_SHARED {{ cookiecutter.is_shared }})
set(IS_BINARY {{ cookiecutter.cxx_project_type == "binary" }})
set(IS_SHARED {{ cookiecutter.cxx_share_enabled }})

if(IS_BINARY)
add_executable(${PROJECT_NAME} ${SOURCES})
Expand Down
2 changes: 1 addition & 1 deletion template/cxx/{{cookiecutter.project_slug}}/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY .. .
RUN cmake -B build && cmake --build build --target {{cookiecutter.project_slug}} --config Release --parallel 8

# DEPLOYING
{% if cookiecutter.project_type == "binary" and not cookiecutter.is_shared -%}
{% if cookiecutter.cxx_project_type == "binary" and not cookiecutter.cxx_share_enabled -%}
FROM scratch
{%- else -%}
FROM rockylinux:9-minimal
Expand Down
23 changes: 13 additions & 10 deletions template/go/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
"project_name": "My Awesome Project",
"project_slug": "{{ cookiecutter.project_name | slugify }}",
"package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}",
"go_version": "1.22",
"short_description": "A nice go project",
"github_username": "your-org-or-username",
"project_desc": "A nice go project",
"full_name": "Firstname Lastname",
"email": "[email protected]",
"github_username": "your-org-or-username",


"go_version": "1.22",


"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}",
"__prompts__": {
"project_name": "Select your project name",
"project_slug": "Project slug",
"package_name": "Package name",
"go_version": "Go version",
"short_description": "Short description",
"project_name": "Enter your project name",
"project_slug": "Generated project identifier (slug)",
"package_name": "Generated package/module name",
"project_desc": "Brief project description",
"github_username": "GitHub username or organization",
"full_name": "Author full name",
"email": "Author email"
"full_name": "Author's full name",
"email": "Author's email address"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
password: {{ "${{ secrets.GITHUB_TOKEN " }}}}
-
name: Build and Export to Docker
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand All @@ -41,7 +41,7 @@ jobs:
docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1}
-
name: Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
2 changes: 1 addition & 1 deletion template/go/{{cookiecutter.project_slug}}/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var cfgFile string

var rootCmd = &cobra.Command{
Use: "{{cookiecutter.project_slug}}",
Short: "{{cookiecutter.short_description}}",
Short: "{{cookiecutter.project_desc}}",
Long: `A long desc for the {{cookiecutter.project_slug}}.
Such as:
- Feature1
Expand Down
25 changes: 14 additions & 11 deletions template/py/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"project_name": "My Awesome Project",
"project_slug": "{{ cookiecutter.project_name | trim | slugify }}",
"project_slug": "{{ cookiecutter.project_name | slugify }}",
"package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}",
"python_version": "3.10",
"short_description": "A nice python project",
"github_username": "your-org-or-username",
"project_desc": "A nice python project",
"full_name": "Firstname Lastname",
"email": "[email protected]",
"github_username": "your-org-or-username",


"python_version": "3.10",


"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}",
"__prompts__": {
"project_name": "Select your project name",
"project_slug": "Project slug",
"package_name": "Package name",
"python_version": "Python version",
"short_description": "Short description",
"project_name": "Enter your project name",
"project_slug": "Generated project identifier (slug)",
"package_name": "Generated package/module name",
"project_desc": "Brief project description",
"github_username": "GitHub username or organization",
"full_name": "Author full name",
"email": "Author email"
"full_name": "Author's full name",
"email": "Author's email address"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
password: {{ "${{ secrets.GITHUB_TOKEN }}" }}
-
name: Build and Export to Docker
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand All @@ -44,7 +44,7 @@ jobs:
docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1}
-
name: Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
2 changes: 1 addition & 1 deletion template/py/{{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "{{cookiecutter.project_slug}}"
version = "0.0.1"
description = "{{cookiecutter.short_description}}"
description = "{{cookiecutter.project_desc}}"
readme = "README.md"
requires-python = ">=3.11"
license = "MIT"
Expand Down

0 comments on commit 7d7f38f

Please sign in to comment.