Skip to content

Commit

Permalink
ci: rename some variables
Browse files Browse the repository at this point in the history
replace - with _
  • Loading branch information
pplmx committed Sep 5, 2022
1 parent db7b912 commit 56aa4cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/template_values.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[values]
gh-username = "cxx-gh"
project-description = "Example of Cxx GitHub template"
cmake-min-version = "3.23"
cxx-standard = "23"
gh_uname = "cxx-gh"
proj_description = "Example of Cxx GitHub template"
cmake_min_version = "3.23"
cxx_standard_version = "23"
4 changes: 2 additions & 2 deletions template/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<!--
Please, make sure:
- you have read the contributing guidelines:
https://github.com/{{gh-username}}/{{project-name}}/blob/main/docs/CONTRIBUTING.md
https://github.com/{{gh_uname}}/{{project-name}}/blob/main/docs/CONTRIBUTING.md
- you have formatted the code using rustfmt:
https://github.com/rust-lang/rustfmt
- you have checked that all tests pass, by running `cargo test --all`
- you have updated the changelog (if needed):
https://github.com/{{gh-username}}/{{project-name}}/blob/main/CHANGELOG.md
https://github.com/{{gh_uname}}/{{project-name}}/blob/main/CHANGELOG.md
-->
14 changes: 8 additions & 6 deletions template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
cmake_minimum_required(VERSION {{cmake-min-version}})
cmake_minimum_required(VERSION {{cmake_min_version}})
project({{project-name}})

set(CMAKE_CXX_STANDARD {{cxx-standard}})
set(CMAKE_CXX_STANDARD {{cxx_standard_version}})

{% if project-type == "bin" %}
{% if proj_type == "bin" -%}
add_executable({{project-name}} src/main.cpp)
{% else if lib-type == "static" %}
{%- else -%}
{%- if lib_type == "static" -%}
# static
add_library({{project-name}} src/library.cpp)
{% else %}
{%- else -%}
# shared
add_library({{project-name}} SHARED src/library.cpp)
{% endif %}
{%- endif %}
{%- endif %}
6 changes: 3 additions & 3 deletions template/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ wish to make by creating a new issue before making the change.
## Reporting issues

Before reporting an issue on the
[issue tracker](https://github.com/{{gh-username}}/{{project-name}}/issues),
[issue tracker](https://github.com/{{gh_uname}}/{{project-name}}/issues),
please check that it has not already been reported by searching for some related
keywords.

Expand All @@ -19,7 +19,7 @@ Try to do one pull request per change.
### Updating the changelog

Update the changes you have made in
[CHANGELOG](https://github.com/{{gh-username}}/{{project-name}}/blob/main/CHANGELOG.md)
[CHANGELOG](https://github.com/{{gh_uname}}/{{project-name}}/blob/main/CHANGELOG.md)
file under the **Unreleased** section.

Add the changes of your pull request to one of the following subsections,
Expand All @@ -42,7 +42,7 @@ If the required subsection does not exist yet under **Unreleased**, create it!
This is no different than other Rust projects.

```shell
git clone https://github.com/{{gh-username}}/{{project-name}}
git clone https://github.com/{{gh_uname}}/{{project-name}}
cd {{project-name}}
cargo test
```
Expand Down
4 changes: 2 additions & 2 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![Crates.io](https://img.shields.io/crates/v/{{project-name}}.svg)](https://crates.io/crates/{{project-name}})
[![Docs.rs](https://docs.rs/{{project-name}}/badge.svg)](https://docs.rs/{{project-name}})
[![CI](https://github.com/{{gh-username}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{gh-username}}/{{project-name}}/actions)
[![Coverage Status](https://coveralls.io/repos/github/{{gh-username}}/{{project-name}}/badge.svg?branch=main)](https://coveralls.io/github/{{gh-username}}/{{project-name}}?branch=main)
[![CI](https://github.com/{{gh_uname}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{gh_uname}}/{{project-name}}/actions)
[![Coverage Status](https://coveralls.io/repos/github/{{gh_uname}}/{{project-name}}/badge.svg?branch=main)](https://coveralls.io/github/{{gh_uname}}/{{project-name}}?branch=main)

## Installation

Expand Down
20 changes: 8 additions & 12 deletions template/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
[template]
cargo_generate_version = ">=0.10.0"

[placeholders.gh-username]
[placeholders.gh_uname]
type = "string"
prompt = "GitHub username (or organization)?"
# The username cannot end with a hyphen, too, but
# this requirement is not captured by the regex at the moment.
regex = "^[A-Za-z0-9][A-Za-z0-9-]{0,38}$"

[placeholders.project-description]
[placeholders.proj_description]
type = "string"
prompt = "Project description?"

[placeholders.cmake-min-version]
[placeholders.cmake_min_version]
type = "string"
prompt = "CMake minimum version?"
regex = "^[0-9]+(\\.[0-9]+){0,2}$"

[placeholders.cxx-standard]
[placeholders.cxx_standard_version]
type = "string"
prompt = "Cxx standard version?"
regex = "^[0-9]+$"

[placeholders.project-type]
[placeholders.proj_type]
type = "string"
prompt = "Which cxx project type?"
choices = [
"bin",
"lib"
]
choices = ["bin", "lib"]
default = "bin"

[conditional.'project-type == "bin"']
[conditional.'proj_type == "bin"']
ignore = ["src/library.h", "src/library.cpp"]

[conditional.'project-type == "lib"'.placeholders.lib-type]
[conditional.'proj_type == "lib"'.placeholders.lib_type]
ignore = ["src/main.cpp"]
type = "string"
prompt = "Which lib type?"
choices = ["static", "shared"]
default = "shared"

0 comments on commit 56aa4cd

Please sign in to comment.