Skip to content

Commit 90b2a6c

Browse files
Merge pull request #14 from sebastienrousseau/feat/libmake
Feat/libmake
2 parents 6c61e6f + a3ca682 commit 90b2a6c

16 files changed

+83
-73
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0"
1414
name = "libmake"
1515
repository = "https://github.com/sebastienrousseau/libmake.git"
1616
rust-version = "1.69.0"
17-
version = "0.1.6"
17+
version = "0.1.7"
1818
include = [
1919
"/CONTRIBUTING.md",
2020
"/LICENSE-APACHE",

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,6 @@ this project.
332332
[codecov-badge]: https://img.shields.io/codecov/c/github/sebastienrousseau/libmake?style=for-the-badge&token=Q9KJ6XXL67 'Codecov'
333333
[crates-badge]: https://img.shields.io/crates/v/libmake.svg?style=for-the-badge 'Crates.io Badge'
334334
[docs-badge]: https://img.shields.io/docsrs/libmake.svg?style=for-the-badge 'Docs.rs Badge'
335-
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.1.6-orange.svg?style=for-the-badge 'Lib.rs Badge'
335+
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.1.7-orange.svg?style=for-the-badge 'Lib.rs Badge'
336336
[license-badge]: https://img.shields.io/crates/l/libmake.svg?style=for-the-badge 'License Badge'
337337
[made-with-rust-badge]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust 'Made With Rust Badge'

TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ The library is designed to be used as a command-line tool. It is available on [C
5555
[codecov-badge]: https://img.shields.io/codecov/c/github/sebastienrousseau/libmake?style=for-the-badge&token=Q9KJ6XXL67 'Codecov'
5656
[crates-badge]: https://img.shields.io/crates/v/libmake.svg?style=for-the-badge 'Crates.io Badge'
5757
[docs-badge]: https://img.shields.io/docsrs/libmake.svg?style=for-the-badge 'Docs.rs Badge'
58-
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.1.6-orange.svg?style=for-the-badge 'Lib.rs Badge'
58+
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.1.7-orange.svg?style=for-the-badge 'Lib.rs Badge'
5959
[license-badge]: https://img.shields.io/crates/l/libmake.svg?style=for-the-badge 'License Badge'
6060
[made-with-rust-badge]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust 'Made With Rust Badge'

src/cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn build_cli() -> Result<ArgMatches, Error> {
147147
)
148148
.arg(
149149
Arg::new("version")
150-
.default_value("0.1.6")
150+
.default_value("0.1.7")
151151
.help("Sets the version of the library")
152152
.long("version")
153153
.short('v')

src/generator.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ pub fn create_template_folder() -> io::Result<()> {
218218
let file_url = format!("{}{}", url, file);
219219
let file_path = template_dir_path.join(file);
220220
let output = Command::new("curl")
221+
.arg("-s")
221222
.arg("-L")
222223
.arg("-o")
223224
.arg(file_path.as_os_str())
@@ -380,7 +381,7 @@ pub fn generate_files(params: FileGenerationParams) -> io::Result<()> {
380381
// Copying the `criterion.tpl` file to the new library directory
381382
copy_and_replace_template(
382383
"criterion.tpl",
383-
"criterion.rs",
384+
"benches/criterion.rs",
384385
&project_directory,
385386
&params,
386387
)?;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//!
1414
//! [![Rust](https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust)](https://www.rust-lang.org)
1515
//! [![Crates.io](https://img.shields.io/crates/v/libmake.svg?style=for-the-badge&color=success&labelColor=27A006)](https://crates.io/crates/libmake)
16-
//! [![Lib.rs](https://img.shields.io/badge/lib.rs-v0.1.6-success.svg?style=for-the-badge&color=8A48FF&labelColor=6F36E4)](https://lib.rs/crates/libmake)
16+
//! [![Lib.rs](https://img.shields.io/badge/lib.rs-v0.1.7-success.svg?style=for-the-badge&color=8A48FF&labelColor=6F36E4)](https://lib.rs/crates/libmake)
1717
//! [![GitHub](https://img.shields.io/badge/github-555555?style=for-the-badge&labelColor=000000&logo=github)](https://github.com/sebastienrousseau/libmake)
1818
//! [![License](https://img.shields.io/crates/l/libmake.svg?style=for-the-badge&color=007EC6&labelColor=03589B)](http://opensource.org/licenses/MIT)
1919
//!

template/Cargo.tpl

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[package]
2-
authors = ["{author} <{email}>"] # Add your name and email here.
3-
build = "{build}" # Add your build command here (e.g. build.rs).
4-
categories = {categories} # Add your categories here. See https://doc.rust-lang.org/cargo/reference/manifest.html?highlight=keywords#the-categories-field for more information.
5-
description = "{description}" # Add your description here.
6-
documentation = "{documentation}" # Add your documentation link here.
7-
edition = "{edition}" # Add your edition here (e.g. 2018).
2+
authors = ["{author} <{email}>"] # Add your name and email here.
3+
build = "{build}" # Add your build command here (e.g. build.rs).
4+
categories = {categories} # Add your categories here. See https://doc.rust-lang.org/cargo/reference/manifest.html?highlight=keywords#the-categories-field for more information.
5+
description = "{description}" # Add your description here.
6+
documentation = "{documentation}" # Add your documentation link here.
7+
edition = "{edition}" # Add your edition here (e.g. 2018).
88
exclude = [
99
"/.git/*",
1010
"/.github/*",
1111
"/.gitignore",
1212
"/.vscode/*"
13-
] # Add files to exclude here
14-
homepage = "{homepage}" # Add your homepage here
15-
keywords = ["{keywords}"] # Add your keywords here. See https://doc.rust-lang.org/cargo/reference/manifest.html?highlight=keywords#the-keywords-field for more information.
16-
license = "{license}" # Add your license here.
17-
name = "{name}" # Add your library name here.
18-
readme = "{readme}" # Add your readme here.
19-
repository = "{repository}" # Add your repository here.
20-
rust-version = "{rustversion}" # Add your rust version here.
21-
version = "{version}" # Add your version here.
13+
] # Add files to exclude here
14+
homepage = "{homepage}" # Add your homepage here
15+
keywords = ["{keywords}"] # Add your keywords here. See https://doc.rust-lang.org/cargo/reference/manifest.html?highlight=keywords#the-keywords-field for more information.
16+
license = "{license}" # Add your license here.
17+
name = "{name}" # Add your library name here.
18+
readme = "{readme}" # Add your readme here.
19+
repository = "{repository}" # Add your repository here.
20+
rust-version = "{rustversion}" # Add your rust version here.
21+
version = "{version}" # Add your version here.
2222
include = [
2323
"/benches/**",
2424
"/build.rs",
@@ -31,7 +31,7 @@ include = [
3131
"/src/**",
3232
"/tests/**",
3333
"/xtask/**",
34-
] # Add files to include here.
34+
] # Add files to include here.
3535

3636
[[bench]]
3737
name = "benchmark"
@@ -60,36 +60,36 @@ default = []
6060
all-features = true
6161

6262
[profile.dev]
63-
codegen-units = 256 # Number of parallel codegen units
64-
debug = true # Enable debug symbols
65-
debug-assertions = true # Enable debug assertions
66-
incremental = true # Enable incremental compilation
67-
lto = false # Disable link-time optimization
68-
opt-level = 0 # Optimize for speed
69-
overflow-checks = true # Enable overflow checks
70-
panic = 'unwind' # Use unwinding panic handling
71-
rpath = false # Disable rpath
72-
strip = false # Disable symbol stripping
63+
codegen-units = 256 # Number of parallel codegen units
64+
debug = true # Enable debug symbols
65+
debug-assertions = true # Enable debug assertions
66+
incremental = true # Enable incremental compilation
67+
lto = false # Disable link-time optimization
68+
opt-level = 0 # Optimize for speed
69+
overflow-checks = true # Enable overflow checks
70+
panic = 'unwind' # Use unwinding panic handling
71+
rpath = false # Disable rpath
72+
strip = false # Disable symbol stripping
7373

7474
[profile.release]
75-
codegen-units = 1 # Number of parallel codegen units
76-
debug = false # Disable debug symbols
77-
debug-assertions = false # Disable debug assertions
78-
incremental = false # Disable incremental compilation
79-
lto = true # Enable link-time optimization
80-
opt-level = "s" # Optimize for size
81-
overflow-checks = false # Disable overflow checks
82-
panic = "abort" # Use aborting panic handling
83-
rpath = false # Disable rpath
84-
strip = "symbols" # Strip symbols
75+
codegen-units = 1 # Number of parallel codegen units
76+
debug = false # Disable debug symbols
77+
debug-assertions = false # Disable debug assertions
78+
incremental = false # Disable incremental compilation
79+
lto = true # Enable link-time optimization
80+
opt-level = "s" # Optimize for size
81+
overflow-checks = false # Disable overflow checks
82+
panic = "abort" # Use aborting panic handling
83+
rpath = false # Disable rpath
84+
strip = "symbols" # Strip symbols
8585

8686
[profile.test]
87-
codegen-units = 256 # Number of parallel codegen units
88-
debug = true # Enable debug symbols
89-
debug-assertions = true # Enable debug assertions
90-
incremental = true # Enable incremental compilation
91-
lto = false # Disable link-time optimization
92-
opt-level = 0 # Optimize for speed
93-
overflow-checks = true # Enable overflow checks
94-
rpath = false # Disable rpath
95-
strip = false # Disable symbol stripping
87+
codegen-units = 256 # Number of parallel codegen units
88+
debug = true # Enable debug symbols
89+
debug-assertions = true # Enable debug assertions
90+
incremental = true # Enable incremental compilation
91+
lto = false # Disable link-time optimization
92+
opt-level = 0 # Optimize for speed
93+
overflow-checks = true # Enable overflow checks
94+
rpath = false # Disable rpath
95+
strip = false # Disable symbol stripping

template/ci.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
- name: Install grcov
133133
run: |
134134
mkdir -p "${HOME}/.local/bin"
135-
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.13/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
135+
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
136136
echo "$HOME/.local/bin" >> $GITHUB_PATH
137137

138138
# Use grcov to generate a coverage report

template/criterion.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn {name}_benchmark(c: &mut Criterion) {
3434
c.bench_function("{name}", |b| {
3535
b.iter(|| {
3636
for _ in 0..1000 {
37-
run();
37+
run().unwrap();
3838
}
3939
})
4040
});

template/macros.tpl

+23-14
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22
//!
33
//! This crate provides the following macros:
44
//!
5-
//! - [`{name}!`]: The main macro for the `{name}` crate.
5+
//! - [`{name}`]: The main macro for the `{name}` crate.
6+
//! - [`{name}_print`]: Prints the arguments to the console.
7+
//! - [`{name}_vec`]: Creates a new vector of the given elements.
8+
//! - [`{name}_map`]: Creates a new map of the given key-value pairs.
9+
//! - [`{name}_assert`]: Checks if the given expression is true.
10+
//! - [`{name}_min`]: Returns the minimum of the given values.
11+
//! - [`{name}_max`]: Returns the maximum of the given values.
12+
//! - [`{name}_split`]: Splits a string into a vector of words.
13+
//! - [`{name}_join`]: Joins a vector of strings into a single string.
14+
//! - [`{name}_print_vec`]: Prints a vector of elements to the console.
615
//!
7-
//! This macro takes any number of arguments and parses them into a
8-
//! Rust value.
916

17+
/// This macro takes any number of arguments and parses them into a
18+
/// Rust value.
1019
#[macro_export]
1120
macro_rules! {name} {
1221
($($tt:tt)*) => {
@@ -15,15 +24,15 @@ macro_rules! {name} {
1524
};
1625
}
1726

18-
//! This macro prints the arguments to the console.
27+
/// This macro prints the arguments to the console.
1928
#[macro_export]
2029
macro_rules! {name}_print {
2130
($($arg:tt)*) => {
2231
println!("{}", format_args!("{}", $($arg)*));
2332
};
2433
}
2534

26-
//! This macro creates a new vector of the given elements.
35+
/// This macro creates a new vector of the given elements.
2736
#[macro_export]
2837
macro_rules! {name}_vec {
2938
($($elem:expr),*) => {{
@@ -33,7 +42,7 @@ macro_rules! {name}_vec {
3342
}};
3443
}
3544

36-
//! This macro creates a new map of the given key-value pairs.
45+
/// This macro creates a new map of the given key-value pairs.
3746
#[macro_export]
3847
macro_rules! {name}_map {
3948
($($key:expr => $value:expr),*) => {{
@@ -44,7 +53,7 @@ macro_rules! {name}_map {
4453
}};
4554
}
4655

47-
//! This macro checks if the given expression is true.
56+
/// This macro checks if the given expression is true.
4857
#[macro_export]
4958
macro_rules! {name}_assert {
5059
($($arg:tt)*) => {
@@ -54,7 +63,7 @@ macro_rules! {name}_assert {
5463
};
5564
}
5665

57-
//! This macro returns the minimum of the given values.
66+
/// This macro returns the minimum of the given values.
5867
#[macro_export]
5968
macro_rules! {name}_min {
6069
($($x:expr),*) => {{
@@ -64,7 +73,7 @@ macro_rules! {name}_min {
6473
}};
6574
}
6675

67-
//! This macro returns the maximum of the given values.
76+
/// This macro returns the maximum of the given values.
6877
#[macro_export]
6978
macro_rules! {name}_max {
7079
($($x:expr),*) => {{
@@ -74,7 +83,7 @@ macro_rules! {name}_max {
7483
}};
7584
}
7685

77-
//! This macro takes a string and splits it into a vector of words.
86+
/// This macro takes a string and splits it into a vector of words.
7887
#[macro_export]
7988
macro_rules! {name}_split {
8089
($s:expr) => {{
@@ -86,8 +95,8 @@ macro_rules! {name}_split {
8695
}};
8796
}
8897

89-
//! This macro takes a vector of strings and joins them together into a
90-
//! single string.
98+
/// This macro takes a vector of strings and joins them together into a
99+
/// single string.
91100
#[macro_export]
92101
macro_rules! {name}_join {
93102
($($s:expr),*) => {{
@@ -99,8 +108,8 @@ macro_rules! {name}_join {
99108
}};
100109
}
101110

102-
//! This macro takes a vector of elements and prints them to the
103-
//! console.
111+
/// This macro takes a vector of elements and prints them to the
112+
/// console.
104113
#[macro_export]
105114
macro_rules! {name}_print_vec {
106115
($($v:expr),*) => {{

tests/data/mylibrary.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
author,build,categories,description,documentation,edition,email,homepage,keywords,license,name,output,readme,repository,rustversion,version,website
2-
Me,build.rs,"['category 1', 'category 2']",A library for doing things,https://lib.rs/crates/my_library,2021,[email protected],https://test.com,"['keyword1', 'keyword2']",MIT OR Apache-2.0,my_library,my_library,README.md,https://github.com/test/test,1.69.0,0.1.6,https://test.com
2+
Me,build.rs,"['category 1', 'category 2']",A library for doing things,https://lib.rs/crates/my_library,2021,[email protected],https://test.com,"['keyword1', 'keyword2']",MIT OR Apache-2.0,my_library,my_library,README.md,https://github.com/test/test,1.69.0,0.1.7,https://test.com

tests/data/mylibrary.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"readme": "README.md",
1515
"repository": "https://github.com/test/test",
1616
"rustversion": "1.69.0",
17-
"version": "0.1.6",
17+
"version": "0.1.7",
1818
"website": "https://test.com"
1919
}

tests/data/mylibrary.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ output = "my_library"
1313
readme = "README.md"
1414
repository = "https://github.com/test/test"
1515
rustversion = "1.69.0"
16-
version = "0.1.6"
16+
version = "0.1.7"
1717
website = "https://test.com"

tests/data/mylibrary.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ output: my_library
1313
readme: README.md
1414
repository: https://github.com/test/test
1515
rustversion: '1.69.0'
16-
version: '0.1.6'
16+
version: '0.1.7'
1717
website: https://test.com

tests/test_cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod tests {
2222
("readme", "README.md"),
2323
("repository", "https://github.com/test/test"),
2424
("rustversion", "1.69.0"),
25-
("version", "0.1.6"),
25+
("version", "0.1.7"),
2626
("website", "https://test.com"),
2727
];
2828

tests/test_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mod tests {
105105
);
106106
assert_eq!(
107107
get_csv_field(Some(file_path), 15),
108-
Some(vec!["0.1.6".to_string()])
108+
Some(vec!["0.1.7".to_string()])
109109
);
110110
assert_eq!(
111111
get_csv_field(Some(file_path), 16),

0 commit comments

Comments
 (0)