Skip to content

Commit

Permalink
chore(libmake): 📝 date updates and optimised examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Jan 16, 2024
1 parent 9b46fe2 commit 1568993
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 24 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["LibMake Contributors"]
categories = ['development-tools', 'command-line-utilities', 'template-engine']
categories = ["development-tools", "command-line-utilities", "template-engine"]
description = """
A code generator to reduce repetitive tasks and build high-quality Rust
libraries and applications, by providing a simple interface to create
Expand All @@ -19,6 +19,7 @@ keywords = [
]
license = "MIT OR Apache-2.0"
name = "libmake"
readme = "README.md"
repository = "https://github.com/sebastienrousseau/libmake.git"
rust-version = "1.75.0"
version = "0.2.1"
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! This is the main function for the build script.
Expand Down
43 changes: 43 additions & 0 deletions examples/example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

/// This is a module for the example `generate_from_args`.
mod generate_from_args;

/// This is a module for the example `generate_from_config`.
mod generate_from_config;

/// This is a module for the example `generate_from_csv`.
mod generate_from_csv;

/// This is a module for the example `generate_from_json`.
mod generate_from_json;

/// This is a module for the example `generate_from_toml`.
mod generate_from_toml;

/// This is a module for the example `generate_from_yaml`.
mod generate_from_yaml;

/// This is a module for the example `get_csv_field`.
mod get_csv_field;

/// This is a module for the example `get_json_field`.
mod get_json_field;

/// This is a module for the example `get_yaml_field`.
mod get_yaml_field;

/// The main function that runs all the example modules.
fn main() {
// Run the `main()` function from each module to execute the examples.
generate_from_args::main();
generate_from_config::main();
generate_from_csv::main();
generate_from_json::main();
generate_from_toml::main();
generate_from_yaml::main();
get_csv_field::main();
get_json_field::main();
get_yaml_field::main();
}
2 changes: 1 addition & 1 deletion examples/generate_from_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Import the necessary function for generating files from arguments
use libmake::generator::generate_from_args;

fn main() {
pub fn main() {
// Simulate command line arguments
let args = "--author=Me --output=my_library"
.split(' ')
Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

use libmake::generator::generate_from_config;

fn main() {
pub fn main() {
// Define the file path for the configuration file.
let file_path = "./tests/data/mylibrary.yaml";

Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use libmake::generator::generate_from_csv;

/// This is a simple test for generating files from a CSV file using the `generate_from_csv` function.
/// It attempts to generate template files from a CSV file and expects the operation to be successful.
fn main() {
pub fn main() {
// Define the path to the CSV file to be used for testing.
let csv_file_path = "./tests/data/mylibrary.csv";

Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use libmake::generator::generate_from_json;

/// This test demonstrates how to use the `generate_from_json` function from the `libmake` crate
/// to generate template files from a JSON file.
fn main() {
pub fn main() {
// Define the path to the JSON file that contains configuration data.
let json_file_path = "./tests/data/mylibrary.json";

Expand Down
4 changes: 2 additions & 2 deletions examples/generate_from_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! use libmake::generator::generate_from_toml;
//!
//! // Define the path to the TOML file containing configuration.
//! let toml_file_path = "./tests/data/mylibrary.toml"
//! let toml_file_path = "./tests/data/mylibrary.toml"
//! // Generate template files based on the configuration in the TOML file.
//! // If generation fails, it will print an error message.
//! generate_from_toml(toml_file_path)
Expand All @@ -26,7 +26,7 @@
// Import the necessary function for generating templates from a TOML file.
use libmake::generator::generate_from_toml;

fn main() {
pub fn main() {
// Define the path to the TOML file containing configuration.
let toml_file_path = "./tests/data/mylibrary.toml";

Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// Import the necessary function for generating templates from a YAML file.
use libmake::generator::generate_from_yaml;

fn main() {
pub fn main() {
// Specify the path to the YAML file to be used for generating templates.
let yaml_file_path = "./tests/data/mylibrary.yaml";

Expand Down
2 changes: 1 addition & 1 deletion examples/get_csv_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Title: Test: Retrieving a CSV Field
use libmake::utils::get_csv_field;

fn main() {
pub fn main() {
// Retrieve CSV field
let file_path = "../tests/data/mylibrary.csv";
println!(
Expand Down
2 changes: 1 addition & 1 deletion examples/get_json_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
use libmake::utils::get_json_field;
use std::path::Path;

fn main() {
pub fn main() {
// Retrieve JSON field
let file_path = "../tests/data/mylibrary.json";
let field_author = "author";
Expand Down
2 changes: 1 addition & 1 deletion examples/get_yaml_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
use libmake::utils::get_yaml_field;
use std::path::Path;

fn main() {
pub fn main() {
let file_path = "../tests/data/mylibrary.yaml";
let field_keywords = "keywords";

Expand Down
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use super::generator::{
Expand Down
2 changes: 1 addition & 1 deletion src/ascii.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use figlet_rs::FIGfont;
Expand Down
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use clap::{Arg, ArgMatches, Command, Error};
Expand Down
2 changes: 1 addition & 1 deletion src/generator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use super::interface::replace_placeholders;
Expand Down
2 changes: 1 addition & 1 deletion src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::{
Expand Down
2 changes: 1 addition & 1 deletion src/loggers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// Standard library imports for formatting and I/O operations.
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Macros for the `libmake` crate.
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! # Libmake Application
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::env;
Expand Down
2 changes: 1 addition & 1 deletion template/loggers.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// Standard library imports for formatting and I/O operations.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_loggers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 LibMake. All rights reserved.
// Copyright © 2024 LibMake. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

#[cfg(test)]
Expand Down

0 comments on commit 1568993

Please sign in to comment.