Skip to content

Commit 85226a6

Browse files
fix(libmake): 🐛 various fixes and improvements to the template files
1 parent c42d4ad commit 85226a6

File tree

18 files changed

+754
-894
lines changed

18 files changed

+754
-894
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ regex = "1.10.4"
6565
reqwest = { version = "0.12.2", features = ["blocking"] }
6666
rlg = "0.0.3"
6767
serde = { version = "1.0.197", features = ["derive"] }
68+
serde_ini = "0.2.0"
6869
serde_json = "1.0.115"
6970
serde_yaml = "0.9.33"
70-
serde_ini = "0.2.0"
7171
tempfile = "3.10.1"
7272
toml = "0.8.12"
7373
uuid = { version = "1.8.0", features = ["v4"] }

src/generator.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ pub fn create_template_folder() -> io::Result<()> {
4242
"example.tpl",
4343
"gitignore.tpl",
4444
"lib.tpl",
45-
"loggers.tpl",
4645
"macros.tpl",
4746
"main.tpl",
4847
"README.tpl",
4948
"rustfmt.tpl",
5049
"TEMPLATE.tpl",
5150
"test.tpl",
52-
"test_loggers.tpl",
5351
];
5452
for file in &files {
5553
let file_path = template_dir_path.join(file);
@@ -186,13 +184,11 @@ pub fn generate_files(params: FileGenerationParams) -> io::Result<()> {
186184
("example.tpl", "examples/example.rs"),
187185
("gitignore.tpl", ".gitignore"),
188186
("lib.tpl", "src/lib.rs"),
189-
("loggers.tpl", "src/loggers.rs"),
190187
("macros.tpl", "src/macros.rs"),
191188
("main.tpl", "src/main.rs"),
192189
("README.tpl", "README.md"),
193190
("rustfmt.tpl", "rustfmt.toml"),
194191
("TEMPLATE.tpl", "TEMPLATE.md"),
195-
("test_loggers.tpl", "tests/test_loggers.rs"),
196192
("test.tpl", "tests/test.rs"),
197193
];
198194

@@ -261,7 +257,7 @@ pub fn generate_files(params: FileGenerationParams) -> io::Result<()> {
261257
/// # Arguments
262258
///
263259
/// - `path` - The path to the configuration file.
264-
/// - `file_type` - The type of the configuration file (e.g., JSON, YAML, CSV).
260+
/// - `file_type` - The type of the configuration file (e.g., JSON, YAML, CSV, TOML and INI).
265261
///
266262
/// # Errors
267263
///

src/models/model_params.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
use serde::{Deserialize, Serialize};
77

8+
fn deserialize_name<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
9+
where
10+
D: serde::Deserializer<'de>,
11+
{
12+
let name = String::deserialize(deserializer)?;
13+
Ok(Some(name.trim_matches('"').to_string()))
14+
}
15+
16+
817
/// Structure for holding the parameters for generating the project files.
918
///
1019
/// # Description
@@ -47,12 +56,14 @@ pub struct FileGenerationParams {
4756
pub keywords: Option<String>,
4857
/// The license under which the project is released (optional).
4958
pub license: Option<String>,
59+
#[serde(deserialize_with = "deserialize_name")]
5060
/// The name of the project (optional).
5161
pub name: Option<String>,
5262
/// The output directory where the project files will be created (optional).
5363
pub output: Option<String>,
5464
/// The name of the readme file (optional).
5565
pub readme: Option<String>,
66+
#[serde(deserialize_with = "deserialize_name")]
5667
/// The URL of the project's repository (optional).
5768
pub repository: Option<String>,
5869
/// The minimum Rust version required by the project (optional).

template/AUTHORS.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Authors
22

3-
* [{author}]({email}) (Original Contributor)
3+
* {author} ({email}) (Original Contributor)

template/CONTRIBUTING.tpl

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
# Contributing to `{name}`
2-
3-
Welcome! We're thrilled that you're interested in contributing to the
4-
`{name}` library. Whether you're looking to evangelize, submit feedback,
5-
or contribute code, we appreciate your involvement in making `{name}` a
6-
better tool for everyone. Here's how you can get started.
7-
8-
## Evangelize
9-
10-
One of the simplest ways to help us out is by spreading the word about
11-
{name}. We believe that a bigger, more involved community makes for a
12-
better framework, and that better frameworks make the world a better
13-
place. If you know people who might benefit from using {name}, please
14-
let them know!
15-
16-
## How to Contribute
17-
18-
If you're interested in making a more direct contribution, there are
19-
several ways you can help us improve {name}. Here are some guidelines
20-
for submitting feedback, bug reports, and code contributions.
21-
22-
### Feedback
23-
24-
Your feedback is incredibly valuable to us, and we're always looking for
25-
ways to make {name} better. If you have ideas, suggestions, or questions
26-
about {name}, we'd love to hear them. Here's how you can provide
27-
feedback:
28-
29-
- Click [here][2] to submit a new feedback.
30-
- Use a descriptive title that clearly summarizes your feedback.
31-
- Provide a detailed description of the issue or suggestion.
32-
- Be patient while we review and respond to your feedback.
33-
34-
### Bug Reports
35-
36-
If you encounter a bug while using {name}, please let us know so we can
37-
fix it. Here's how you can submit a bug report:
38-
39-
- Click [here][2] to submit a new issue.
40-
- Use a descriptive title that clearly summarizes the bug.
41-
- Provide a detailed description of the issue, including steps to
42-
reproduce it.
43-
- Be patient while we review and respond to your bug report.
44-
45-
### Code Contributions
46-
47-
If you're interested in contributing code to {name}, we're excited to
48-
have your help! Here's what you need to know:
49-
50-
#### Feature Requests
51-
52-
If you have an idea for a new feature or improvement, we'd love to hear
53-
it. Here's how you can contribute code for a new feature to {name}:
54-
55-
- Fork the repo.
56-
- Clone the {name}[1] repo by running:
57-
`git clone {repository}`
58-
- Edit files in the `src/` folder. The `src/` folder contains the source
59-
code for {name}.
60-
- Submit a pull request, and we'll review and merge your changes if they
61-
fit with our vision for {name}.
62-
63-
#### Submitting Code
64-
65-
If you've identified a bug or have a specific code improvement in mind,
66-
we welcome your pull requests. Here's how to submit your code changes:
67-
68-
- Fork the repo.
69-
- Clone the {name} repo by running:
70-
`git clone {repository}`
71-
- Edit files in the `src/` folder. The `src/` folder contains the source
72-
code for {name}.
73-
- Submit a pull request, and we'll review and merge your changes if they
74-
fit with our vision for {name}.
75-
76-
We hope that this guide has been helpful in explaining how you can
77-
contribute to {name}. Thank you for your interest and involvement in our
78-
project!
79-
80-
[1]: {repository}
81-
[2]: {repository}/issues/newHTTP/2 416
1+
# Contributing to `{name}`
2+
3+
Welcome! We're thrilled that you're interested in contributing to the
4+
`{name}` library. Whether you're looking to evangelize, submit feedback,
5+
or contribute code, we appreciate your involvement in making `{name}` a
6+
better tool for everyone. Here's how you can get started.
7+
8+
## Evangelize
9+
10+
One of the simplest ways to help us out is by spreading the word about
11+
{name}. We believe that a bigger, more involved community makes for a
12+
better framework, and that better frameworks make the world a better
13+
place. If you know people who might benefit from using {name}, please
14+
let them know!
15+
16+
## How to Contribute
17+
18+
If you're interested in making a more direct contribution, there are
19+
several ways you can help us improve {name}. Here are some guidelines
20+
for submitting feedback, bug reports, and code contributions.
21+
22+
### Feedback
23+
24+
Your feedback is incredibly valuable to us, and we're always looking for
25+
ways to make {name} better. If you have ideas, suggestions, or questions
26+
about {name}, we'd love to hear them. Here's how you can provide
27+
feedback:
28+
29+
- Click [here][2] to submit a new feedback.
30+
- Use a descriptive title that clearly summarizes your feedback.
31+
- Provide a detailed description of the issue or suggestion.
32+
- Be patient while we review and respond to your feedback.
33+
34+
### Bug Reports
35+
36+
If you encounter a bug while using {name}, please let us know so we can
37+
fix it. Here's how you can submit a bug report:
38+
39+
- Click [here][2] to submit a new issue.
40+
- Use a descriptive title that clearly summarizes the bug.
41+
- Provide a detailed description of the issue, including steps to
42+
reproduce it.
43+
- Be patient while we review and respond to your bug report.
44+
45+
### Code Contributions
46+
47+
If you're interested in contributing code to {name}, we're excited to
48+
have your help! Here's what you need to know:
49+
50+
#### Feature Requests
51+
52+
If you have an idea for a new feature or improvement, we'd love to hear
53+
it. Here's how you can contribute code for a new feature to {name}:
54+
55+
- Fork the repo.
56+
- Clone the {name}[1] repo by running:
57+
`git clone {repository}`
58+
- Edit files in the `src/` folder. The `src/` folder contains the source
59+
code for {name}.
60+
- Submit a pull request, and we'll review and merge your changes if they
61+
fit with our vision for {name}.
62+
63+
#### Submitting Code
64+
65+
If you've identified a bug or have a specific code improvement in mind,
66+
we welcome your pull requests. Here's how to submit your code changes:
67+
68+
- Fork the repo.
69+
- Clone the {name} repo by running:
70+
`git clone {repository}`
71+
- Edit files in the `src/` folder. The `src/` folder contains the source
72+
code for {name}.
73+
- Submit a pull request, and we'll review and merge your changes if they
74+
fit with our vision for {name}.
75+
76+
We hope that this guide has been helpful in explaining how you can
77+
contribute to {name}. Thank you for your interest and involvement in our
78+
project!
79+
80+
[1]: {repository}
81+
[2]: {repository}/issues/new

template/Cargo.tpl

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
11
[package]
2-
authors = ["{author} <{email}>"]
3-
build = "{build}"
4-
categories = [{categories}]
5-
description = "{description}"
6-
documentation = "{documentation}"
7-
edition = "{edition}"
8-
exclude = [
9-
"/.git/*",
10-
"/.github/*",
11-
"/.gitignore",
12-
"/.vscode/*"
13-
]
14-
homepage = "{homepage}"
15-
keywords = ["{keywords}"]
16-
license = "{license}"
2+
authors = [{author}]
3+
build = {build}
4+
categories = {categories}
5+
description = {description}
6+
documentation = {documentation}
7+
edition = {edition}
8+
exclude = ["/.git/*", "/.github/*", "/.gitignore", "/.vscode/*"]
9+
homepage = {homepage}
10+
keywords = {keywords}
11+
license = {license}
1712
name = "{name}"
18-
readme = "{readme}"
13+
readme = {readme}
1914
repository = "{repository}"
20-
rust-version = "{rustversion}"
21-
version = "{version}"
15+
rust-version = {rustversion}
16+
version = {version}
2217
include = [
18+
"/CONTRIBUTING.md",
19+
"/LICENSE-APACHE",
20+
"/LICENSE-MIT",
2321
"/benches/**",
2422
"/build.rs",
2523
"/Cargo.toml",
26-
"/CONTRIBUTING.md",
2724
"/examples/**",
28-
"/LICENSE-APACHE",
29-
"/LICENSE-MIT",
3025
"/README.md",
3126
"/src/**",
3227
"/tests/**"
@@ -46,7 +41,7 @@ dtt = "0.0.5"
4641
env_logger = "0.11.3"
4742
rlg = "0.0.3"
4843
serde = { version = "1.0.197", features = ["derive"] }
49-
serde_json = "1.0.114"
44+
serde_json = "1.0.115"
5045
serde_yaml = "0.9.33"
5146
toml = "0.8.12"
5247
vrd = "0.0.6"

0 commit comments

Comments
 (0)