From 6af29df5b4b21e7c9e53613b350487b7961684cc Mon Sep 17 00:00:00 2001 From: Sebastien Rousseau Date: Wed, 17 Jan 2024 07:25:59 +0000 Subject: [PATCH] docs(libmake): :adhesive_bandage: updated terms --- build.rs | 1 - examples/example.rs | 1 - src/args.rs | 1 - src/ascii.rs | 1 - src/cli.rs | 1 - src/generator.rs | 1 - src/interface.rs | 1 - src/loggers.rs | 1 - src/macros.rs | 1 - src/main.rs | 1 - src/parser.rs | 1 - src/utils.rs | 1 - template/build.tpl | 19 ++-- template/criterion.tpl | 102 +++++++++--------- template/lib.tpl | 236 +++++++++++++++++++++-------------------- template/loggers.tpl | 1 - template/main.tpl | 24 +++-- tests/test_loggers.rs | 1 - 18 files changed, 196 insertions(+), 199 deletions(-) diff --git a/build.rs b/build.rs index c27f3b6..d4ab58d 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT //! This is the main function for the build script. //! diff --git a/examples/example.rs b/examples/example.rs index db4c571..14da75f 100644 --- a/examples/example.rs +++ b/examples/example.rs @@ -5,7 +5,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT // Module Declarations // Each `mod` statement declares a module in the current crate. diff --git a/src/args.rs b/src/args.rs index fd0603e..cf83691 100644 --- a/src/args.rs +++ b/src/args.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use super::generator::{ generate_files, generate_from_csv, FileGenerationParams, diff --git a/src/ascii.rs b/src/ascii.rs index 3db1d54..9791fd6 100644 --- a/src/ascii.rs +++ b/src/ascii.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use figlet_rs::FIGfont; use std::error::Error; diff --git a/src/cli.rs b/src/cli.rs index 6d1d99a..8352901 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use clap::{Arg, ArgMatches, Command, Error}; diff --git a/src/generator.rs b/src/generator.rs index 9bdbd37..4b167cf 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use super::interface::replace_placeholders; use serde::{Deserialize, Serialize}; diff --git a/src/interface.rs b/src/interface.rs index 97f7699..6bc43c9 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use std::{ fs::File, diff --git a/src/loggers.rs b/src/loggers.rs index 19bbfa2..b1d7705 100644 --- a/src/loggers.rs +++ b/src/loggers.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT //! Application logging functionality //! diff --git a/src/macros.rs b/src/macros.rs index b492c33..270538f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT //! Macros for the `libmake` crate. //! diff --git a/src/main.rs b/src/main.rs index 6da9d99..6e61a0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT //! # Libmake Application //! diff --git a/src/parser.rs b/src/parser.rs index cca9b69..3bf44f5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT /// A macro for getting a configuration field from a configuration file. pub mod get_config_field; diff --git a/src/utils.rs b/src/utils.rs index f50d667..ec72866 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT use std::env; use std::fs::File; diff --git a/template/build.tpl b/template/build.tpl index d44c74e..8a64ac5 100644 --- a/template/build.tpl +++ b/template/build.tpl @@ -1,7 +1,12 @@ -// SPDX-FileCopyrightText: Copyright © 2023 {name}. All rights reserved. -// SPDX-License-Identifier: {license} - -fn main() { - // println!("cargo:rerun-if-changed=src/lib.rs"); - // println!("cargo:rerun-if-changed=build.rs"); -} \ No newline at end of file +// Copyright notice and licensing information. +// These lines indicate the copyright of the software and its licensing terms. +// Copyright © 2024 {name}. All rights reserved. +// SPDX-License-Identifier: {license} + +//! This is the main function for the build script. +//! +//! Currently, it only instructs Cargo to re-run this build script if `build.rs` is changed. +fn main() { + // println!("cargo:rerun-if-changed=src/lib.rs"); + // println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/template/criterion.tpl b/template/criterion.tpl index 5e40200..2123c57 100644 --- a/template/criterion.tpl +++ b/template/criterion.tpl @@ -1,50 +1,52 @@ -// SPDX-FileCopyrightText: Copyright © 2023 {name}. All rights reserved. -// SPDX-License-Identifier: {license} - -extern crate criterion; - -use criterion::{criterion_group, criterion_main, Criterion}; -use {name}::{run, {name}_vec, {name}_map, {name}_join}; - -fn {name}_vec_benchmark(c: &mut Criterion) { - c.bench_function("{name}_vec_macro", |b| { - b.iter(|| { - {name}_vec![1, 2, 3, 4, 5] - }) - }); -} - -fn {name}_map_benchmark(c: &mut Criterion) { - c.bench_function("{name}_map_macro", |b| { - b.iter(|| { - {name}_map!["a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5] - }) - }); -} - -fn {name}_join_benchmark(c: &mut Criterion) { - c.bench_function("{name}_join_macro", |b| { - b.iter(|| { - {name}_join!["a", "b", "c", "d", "e"] - }) - }); -} - -fn {name}_benchmark(c: &mut Criterion) { - c.bench_function("{name}", |b| { - b.iter(|| { - for _ in 0..1000 { - run().unwrap(); - } - }) - }); -} - -criterion_group!( - {name}_macros_benchmark, - {name}_vec_benchmark, - {name}_map_benchmark, - {name}_join_benchmark, - {name}_benchmark -); -criterion_main!({name}_macros_benchmark); \ No newline at end of file +// Copyright notice and licensing information. +// These lines indicate the copyright of the software and its licensing terms. +// Copyright © 2024 {name}. All rights reserved. +// SPDX-License-Identifier: {license} + +extern crate criterion; + +use criterion::{criterion_group, criterion_main, Criterion}; +use {name}::{run, {name}_vec, {name}_map, {name}_join}; + +fn {name}_vec_benchmark(c: &mut Criterion) { + c.bench_function("{name}_vec_macro", |b| { + b.iter(|| { + {name}_vec![1, 2, 3, 4, 5] + }) + }); +} + +fn {name}_map_benchmark(c: &mut Criterion) { + c.bench_function("{name}_map_macro", |b| { + b.iter(|| { + {name}_map!["a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5] + }) + }); +} + +fn {name}_join_benchmark(c: &mut Criterion) { + c.bench_function("{name}_join_macro", |b| { + b.iter(|| { + {name}_join!["a", "b", "c", "d", "e"] + }) + }); +} + +fn {name}_benchmark(c: &mut Criterion) { + c.bench_function("{name}", |b| { + b.iter(|| { + for _ in 0..1000 { + run().unwrap(); + } + }) + }); +} + +criterion_group!( + {name}_macros_benchmark, + {name}_vec_benchmark, + {name}_map_benchmark, + {name}_join_benchmark, + {name}_benchmark +); +criterion_main!({name}_macros_benchmark); diff --git a/template/lib.tpl b/template/lib.tpl index 5d8911b..4af36bf 100644 --- a/template/lib.tpl +++ b/template/lib.tpl @@ -1,117 +1,119 @@ -// SPDX-FileCopyrightText: Copyright © 2023 {name}. All rights reserved. -// SPDX-License-Identifier: {license} -//! -//! # `{name}` 🦀 -//! -//! [![{name}](https://via.placeholder.com/1500x500.png/000000/FFFFFF?text={name})]({website} "{name} - {description}") -//! -//! {description} -//! -//! [![Crates.io](https://img.shields.io/crates/v/{name}.svg?style=for-the-badge&color=success&labelColor=27A006)](https://crates.io/crates/{name} "Crates.io") -//! [![Lib.rs](https://img.shields.io/badge/lib.rs-v{version}-success.svg?style=for-the-badge&color=8A48FF&labelColor=6F36E4)](https://lib.rs/crates/{name} "Lib.rs") -//! [![License](https://img.shields.io/crates/l/{name}.svg?style=for-the-badge&color=007EC6&labelColor=03589B)]({license} "{license}") -//! [![Rust](https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust)](https://www.rust-lang.org "Rust") -//! -//! ## Overview -//! -//! {description} -//! -//! ## Features -//! -//! - ... -//! - ... -//! - ... -//! -//! ## Usage -//! -//! Add the following to your `Cargo.toml` file: -//! -//! ```toml -//! [dependencies] -//! {name} = "{version}" -//! serde = { version = "1.0", features = ["derive"] } -//! serde_json = "1.0" -//! ``` -//! -//! ## Examples -//! -//! Check out the examples folder for helpful snippets of code that -//! demonstrate how to use the `{name}` library. You can also check out -//! the [documentation](https://docs.rs/{name}) for more information on -//! how to use the library. -//! -//! ```rust -//! use {name}::{name}; -//! -//! ``` -//! -//! ## License -//! -//! The project is licensed under the terms of the {license} license. -//! -#![cfg_attr(feature = "bench", feature(test))] -#![deny(dead_code)] -#![deny(missing_debug_implementations)] -#![deny(missing_docs)] -#![forbid(unsafe_code)] -#![warn(unreachable_pub)] -#![doc( - html_favicon_url = "", - html_logo_url = "", - html_root_url = "https://docs.rs/{name}" -)] -#![crate_name = "{name}"] -#![crate_type = "lib"] - -/// The `loggers` module contains the loggers for the library. -pub mod loggers; - -/// The `macros` module contains functions for generating macros. -pub mod macros; - -use serde::{Deserialize, Serialize}; -use std::error::Error; - -#[non_exhaustive] -#[derive( - Clone, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize, -)] - -#[allow(non_camel_case_types)] -/// {name} is a data structure that ... -pub struct {name} { - // Add any data fields needed here -} - -/// This is the main entry point for the {name} library. -pub fn run() -> Result<(), Box> { - // Add your code here - let name = "{name}"; - println!("Hello, {}!", { name }.to_uppercase()); - Ok(()) -} - - -impl {name} { - /// Creates a new instance of {name} - pub fn new() -> Self { - Self { - // Initialize any data fields here - } - } -} - -impl Default for {name} { - /// Creates a new instance of {name} with default values - fn default() -> Self { - Self::new() - } -} \ No newline at end of file +// Copyright notice and licensing information. +// These lines indicate the copyright of the software and its licensing terms. +// Copyright © 2024 {name}. All rights reserved. +// SPDX-License-Identifier: {license} +//! +//! # `{name}` 🦀 +//! +//! [![{name}](https://via.placeholder.com/1500x500.png/000000/FFFFFF?text={name})]({website} "{name} - {description}") +//! +//! {description} +//! +//! [![Crates.io](https://img.shields.io/crates/v/{name}.svg?style=for-the-badge&color=success&labelColor=27A006)](https://crates.io/crates/{name} "Crates.io") +//! [![Lib.rs](https://img.shields.io/badge/lib.rs-v{version}-success.svg?style=for-the-badge&color=8A48FF&labelColor=6F36E4)](https://lib.rs/crates/{name} "Lib.rs") +//! [![License](https://img.shields.io/crates/l/{name}.svg?style=for-the-badge&color=007EC6&labelColor=03589B)]({license} "{license}") +//! [![Rust](https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust)](https://www.rust-lang.org "Rust") +//! +//! ## Overview +//! +//! {description} +//! +//! ## Features +//! +//! - ... +//! - ... +//! - ... +//! +//! ## Usage +//! +//! Add the following to your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! {name} = "{version}" +//! serde = { version = "1.0", features = ["derive"] } +//! serde_json = "1.0" +//! ``` +//! +//! ## Examples +//! +//! Check out the examples folder for helpful snippets of code that +//! demonstrate how to use the `{name}` library. You can also check out +//! the [documentation](https://docs.rs/{name}) for more information on +//! how to use the library. +//! +//! ```rust +//! use {name}::{name}; +//! +//! ``` +//! +//! ## License +//! +//! The project is licensed under the terms of the {license} license. +//! +#![cfg_attr(feature = "bench", feature(test))] +#![deny(dead_code)] +#![deny(missing_debug_implementations)] +#![deny(missing_docs)] +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![doc( + html_favicon_url = "", + html_logo_url = "", + html_root_url = "https://docs.rs/{name}" +)] +#![crate_name = "{name}"] +#![crate_type = "lib"] + +/// The `loggers` module contains the loggers for the library. +pub mod loggers; + +/// The `macros` module contains functions for generating macros. +pub mod macros; + +use serde::{Deserialize, Serialize}; +use std::error::Error; + +#[non_exhaustive] +#[derive( + Clone, + Debug, + Deserialize, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, + Serialize, +)] + +#[allow(non_camel_case_types)] +/// {name} is a data structure that ... +pub struct {name} { + // Add any data fields needed here +} + +/// This is the main entry point for the {name} library. +pub fn run() -> Result<(), Box> { + // Add your code here + let name = "{name}"; + println!("Hello, {}!", { name }.to_uppercase()); + Ok(()) +} + + +impl {name} { + /// Creates a new instance of {name} + pub fn new() -> Self { + Self { + // Initialize any data fields here + } + } +} + +impl Default for {name} { + /// Creates a new instance of {name} with default values + fn default() -> Self { + Self::new() + } +} diff --git a/template/loggers.tpl b/template/loggers.tpl index bb53995..6057321 100644 --- a/template/loggers.tpl +++ b/template/loggers.tpl @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT // Standard library imports for formatting and I/O operations. use std::{ diff --git a/template/main.tpl b/template/main.tpl index 3b2987d..435fb7d 100644 --- a/template/main.tpl +++ b/template/main.tpl @@ -1,11 +1,13 @@ -// SPDX-FileCopyrightText: Copyright © 2023 {name}. All rights reserved. -// SPDX-License-Identifier: {license} - -/// This is the main entry point for the {name} application. -fn main() { - // Call the `run()` function from the `{name}` module. - if let Err(err) = {name}::run() { - eprintln!("Error running {name}: {}", err); - std::process::exit(1); - } -} \ No newline at end of file +// Copyright notice and licensing information. +// These lines indicate the copyright of the software and its licensing terms. +// Copyright © 2024 {name}. All rights reserved. +// SPDX-License-Identifier: {license} + +/// This is the main entry point for the {name} application. +fn main() { + // Call the `run()` function from the `{name}` module. + if let Err(err) = {name}::run() { + eprintln!("Error running {name}: {}", err); + std::process::exit(1); + } +} diff --git a/tests/test_loggers.rs b/tests/test_loggers.rs index 2a26313..7c7984e 100644 --- a/tests/test_loggers.rs +++ b/tests/test_loggers.rs @@ -2,7 +2,6 @@ // These lines indicate the copyright of the software and its licensing terms. // SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses. // Copyright © 2024 LibMake. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 OR MIT #[cfg(test)] mod tests {