Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(libmake): ✨ v0.2.2 #33

Merged
merged 11 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.DS_Store
*.profraw
ssg.log
*.log
/.vscode/
/target/
build
Expand Down
71 changes: 56 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ name = "libmake"
readme = "README.md"
repository = "https://github.com/sebastienrousseau/libmake.git"
rust-version = "1.75.0"
version = "0.2.1"
version = "0.2.2"
include = [
"/CONTRIBUTING.md",
"/LICENSE-APACHE",
Expand Down Expand Up @@ -52,27 +52,32 @@ path = "benches/criterion.rs"
debug = true

[dependencies]
anyhow = "1.0.77"
assert_cmd = "2.0.12"
clap = "4.4.12"
anyhow = "1.0.81"
assert_cmd = "2.0.14"
clap = "4.5.3"
csv = "1.3.0"
dtt = "0.0.5"
env_logger = "0.10.1"
env_logger = "0.11.3"
figlet-rs = "0.1.5"
openssl = { version = "0.10.62", features = ["vendored"] }
reqwest = { version = "0.11.23", features = ["blocking"] }
rlg = "0.0.2"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_yaml = "0.9.29"
tempfile = "3.9.0"
toml = "0.8.8"
vrd = "0.0.5"
configparser = "3.0.4"
reqwest = { version = "0.12.1", features = ["blocking"] }
rlg = "0.0.3"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
serde_yaml = "0.9.33"
tempfile = "3.10.1"
toml = "0.8.12"
uuid = { version = "1.8.0", features = ["v4"] }
vrd = "0.0.6"
xtasks = "0.0.2"

# Unix platforms use OpenSSL for now to provide SSL functionality
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
openssl = { version = "0.10.64", features = ["vendored"] }

[dev-dependencies]
criterion = "0.5.1"
predicates = "3.0.4"
predicates = "3.1.0"

[lib]
crate-type = ["lib"]
Expand All @@ -83,6 +88,42 @@ required-features = []
[features]
default = []

# Linting config
[lints.rust]

## Forbid
missing_debug_implementations = "forbid"
missing_docs = "warn"
non_ascii_idents = "forbid"
unreachable_pub = "forbid"
unsafe_code = "forbid"

## Deny
dead_code = "deny"
deprecated_in_future = "deny"
ellipsis_inclusive_range_patterns = "deny"
explicit_outlives_requirements = "deny"
future_incompatible = "deny"
keyword_idents = "deny"
macro_use_extern_crate = "deny"
meta_variable_misuse = "deny"
missing_fragment_specifier = "deny"
noop_method_call = "deny"
pointer_structural_match = "deny"
rust_2018_idioms = "deny"
rust_2021_compatibility = "deny"
single_use_lifetimes = "deny"
trivial_casts = "deny"
trivial_numeric_casts = "deny"
unused = "deny"
unused_features = "deny"
unused_import_braces = "deny"
unused_labels = "deny"
unused_lifetimes = "deny"
unused_macro_rules = "deny"
unused_qualifications = "deny"
variant_size_differences = "deny"

[profile.dev]
codegen-units = 256
debug = true
Expand Down
66 changes: 44 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ The library is designed to be used as a command-line tool. It is available on [C
- [Documentation](#documentation)
- [Usage](#usage)
- [Command-line interface](#command-line-interface)
- [Generate a new library using a CSV file](#generate-a-new-library-using-a-csv-file)
- [Generate a new library using a JSON file](#generate-a-new-library-using-a-json-file)
- [Generate a new library using a TOML file](#generate-a-new-library-using-a-toml-file)
- [Generate a new library using a YAML file](#generate-a-new-library-using-a-yaml-file)
- [Passing a configuration file](#passing-a-configuration-file)
- [Generate a new library using a CSV file](#generate-a-new-library-using-a-csv-file)
- [Generate a new library using an INI file](#generate-a-new-library-using-an-ini-file)
- [Generate a new library using a JSON file](#generate-a-new-library-using-a-json-file)
- [Generate a new library using a TOML file](#generate-a-new-library-using-a-toml-file)
- [Generate a new library using a YAML file](#generate-a-new-library-using-a-yaml-file)
- [Generate a new library using the command-line interface (CLI) directly](#generate-a-new-library-using-the-command-line-interface-cli-directly)
- [Examples](#examples)
- [Semantic Versioning Policy](#semantic-versioning-policy)
Expand Down Expand Up @@ -99,7 +101,7 @@ libmake --help

### Requirements

The minimum supported Rust toolchain version is currently Rust `1.71.1` or later (stable).
The minimum supported Rust toolchain version is currently Rust `1.75.0` or later (stable).

`LibMake` is supported and has been tested on the following platforms:

Expand Down Expand Up @@ -149,72 +151,91 @@ support additional platforms, please submit a pull request.

`LibMake` provides a command-line interface to generate a new library project. There are a few options available to help you get started.

#### Generate a new library using a CSV file
#### Passing a configuration file

##### Generate a new library using a CSV file

The following command generates a library template from a CSV file.

Have a look at the `tests/data/mylibrary.csv` file for an example and
feel free to use it for your own library as a template.

```shell
libmake --csv tests/data/mylibrary.csv
libmake file --csv tests/data/mylibrary.csv
```

or locally if you have cloned the repository:

```shell
cargo run -- file --csv tests/data/mylibrary.csv
```

##### Generate a new library using an INI file

The following command generates a library template from an INI file.

Have a look at the `tests/data/mylibrary.ini` file for an example and
feel free to use it for your own library as a template.

```shell
libmake file --ini tests/data/mylibrary.ini
```

or locally if you have cloned the repository:

```shell
cargo run -- --csv tests/data/mylibrary.csv
cargo run -- file --ini tests/data/mylibrary.ini
```

#### Generate a new library using a JSON file
##### Generate a new library using a JSON file

The following command generates a library template from a JSON file.

Have a look at the `tests/data/mylibrary.json` file for an example and
feel free to use it for your own library as a template.

```shell
libmake --json tests/data/mylibrary.json
libmake file --json tests/data/mylibrary.json
```

or locally if you have cloned the repository:

```shell
cargo run -- --json tests/data/mylibrary.json
cargo run -- file --json tests/data/mylibrary.json
```

#### Generate a new library using a TOML file
##### Generate a new library using a TOML file

The following command generates a library template from a TOML file.

Have a look at the `tests/data/mylibrary.toml` file for an example and
feel free to use it for your own library as a template.

```shell
libmake --toml tests/data/mylibrary.toml
libmake file --toml tests/data/mylibrary.toml
```

or locally if you have cloned the repository:

```shell
cargo run -- --toml tests/data/mylibrary.toml
cargo run -- file --toml tests/data/mylibrary.toml
```

#### Generate a new library using a YAML file
##### Generate a new library using a YAML file

The following command generates a library template from a YAML file.

Have a look at the `tests/data/mylibrary.yaml` file for an example and
feel free to use it for your own library as a template.

```shell
libmake --yml tests/data/mylibrary.yaml
libmake file --yaml tests/data/mylibrary.yaml
```

or locally if you have cloned the repository:

```shell
cargo run -- --yml tests/data/mylibrary.yaml
cargo run -- file --yaml tests/data/mylibrary.yaml
```

#### Generate a new library using the command-line interface (CLI) directly
Expand All @@ -223,7 +244,7 @@ The following command generates a library template using the command-line
interface.

```shell
libmake \
libmake manual\
--author "John Smith" \
--build "build.rs" \
--categories "['category 1', 'category 2', 'category 3']" \
Expand All @@ -238,15 +259,15 @@ libmake \
--output "my_library" \
--readme "README.md" \
--repository "https://github.com/example/my_library" \
--rustversion "1.71.1" \
--rustversion "1.75.0" \
--version "0.1.0" \
--website "https://example.com/john-smith"
```

or locally if you have cloned the repository:

```shell
cargo run -- --author "John Smith" \
cargo run -- manual --author "John Smith" \
--build "build.rs" \
--categories "['category 1', 'category 2', 'category 3']" \
--description "A Rust library for doing cool things" \
Expand All @@ -260,7 +281,7 @@ cargo run -- --author "John Smith" \
--output "my_library" \
--readme "README.md" \
--repository "https://github.com/example/my_library" \
--rustversion "1.71.1" \
--rustversion "1.75.0" \
--version "0.1.0" \
--website "https://example.com/john-smith"
```
Expand All @@ -276,6 +297,7 @@ To run the examples, clone the repository and run the following command in your
| `generate_from_args` | Generates a library template using the command-line interface. | `cargo run --example generate_from_args` |
| `generate_from_config` | Generates a library template from a configuration file. | `cargo run --example generate_from_config` |
| `generate_from_csv` | Generates a library template from a CSV file. | `cargo run --example generate_from_csv` |
| `generate_from_ini` | Generates a library template from an INI file. | `cargo run --example generate_from_ini` |
| `generate_from_json` | Generates a library template from a JSON file. | `cargo run --example generate_from_json` |
| `generate_from_toml` | Generates a library template from a TOML file. | `cargo run --example generate_from_toml` |
| `generate_from_yaml` | Generates a library template from a YAML file. | `cargo run --example generate_from_yaml` |
Expand Down Expand Up @@ -334,6 +356,6 @@ providing a lot of useful suggestions on how to improve this project.
[crates-badge]: https://img.shields.io/crates/v/libmake.svg?style=for-the-badge "Crates.io Badge"
[divider]: https://kura.pro/common/images/elements/divider.svg "divider"
[docs-badge]: https://img.shields.io/docsrs/libmake.svg?style=for-the-badge "Docs.rs Badge"
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.2.1-orange.svg?style=for-the-badge "Lib.rs Badge"
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.2.2-orange.svg?style=for-the-badge "Lib.rs Badge"
[license-badge]: https://img.shields.io/crates/l/libmake.svg?style=for-the-badge "License Badge"
[made-with-rust-badge]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust "Made With Rust Badge"
5 changes: 3 additions & 2 deletions TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
alt="LibMake logo" width="261" align="right" />

<!-- markdownlint-enable MD033 MD041 -->
# LibMake v0.2.1 🦀

# LibMake v0.2.2 🦀

A code generator to reduce repetitive tasks and build high-quality Rust libraries.

Expand Down Expand Up @@ -63,6 +64,6 @@ The library is designed to be used as a command-line tool. It is available on [C
[codecov-badge]: https://img.shields.io/codecov/c/github/sebastienrousseau/libmake?style=for-the-badge&token=Q9KJ6XXL67 "Codecov Badge"
[crates-badge]: https://img.shields.io/crates/v/libmake.svg?style=for-the-badge "Crates.io Badge"
[docs-badge]: https://img.shields.io/docsrs/libmake.svg?style=for-the-badge "Docs.rs Badge"
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.2.1-orange.svg?style=for-the-badge "Lib.rs Badge"
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.2.2-orange.svg?style=for-the-badge "Lib.rs Badge"
[license-badge]: https://img.shields.io/crates/l/libmake.svg?style=for-the-badge "License Badge"
[made-with-rust-badge]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust "Made With Rust Badge"
2 changes: 0 additions & 2 deletions benches/criterion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
//! from the `libmake` crate, helping you evaluate and optimize its performance.

#![allow(missing_docs)]
extern crate criterion;
extern crate libmake;

use criterion::{criterion_group, criterion_main, Criterion};
use libmake::run;
Expand Down
4 changes: 2 additions & 2 deletions examples/generate_from_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ use libmake::generator::generate_from_args;
/// If successful, this program will print "Successfully generated files!".
///
/// If there is an error, it will print an error message.
pub fn main() {
pub(crate) fn main() {
// Simulate command line arguments
let args = "--author=Me --output=my_library"
.split(' ')
.map(std::string::ToString::to_string) // Directly using the method
.map(ToString::to_string) // Directly using the method
.collect::<Vec<String>>();

// Check if there are at least two arguments (program name and at least one option)
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 @@ -49,7 +49,7 @@ use libmake::generator::generate_from_config;
///
/// * `Ok(())` - If generation is successful.
/// * `Err(String)` - If there is an error during generation.
pub fn main() {
pub(crate) 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 @@ -57,7 +57,7 @@ use libmake::generator::generate_from_csv;
/// generate_from_csv(csv_file_path)
/// .expect("Failed to generate the template files");
/// ```
pub fn main() {
pub(crate) 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 @@ -46,7 +46,7 @@ use libmake::generator::generate_from_json;
///
/// * `Result<(), String>` - Returns `Ok(())` if the template files are generated successfully, or returns an error message if there is an error during generation.
///
pub fn main() {
pub(crate) fn main() {
// Define the path to the JSON file that contains configuration data.
let json_file_path = "./tests/data/mylibrary.json";

Expand Down
2 changes: 1 addition & 1 deletion examples/generate_from_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use libmake::generator::generate_from_toml;
///
/// * `Result<(), String>` - Returns `Ok(())` if the template files are generated successfully, or returns an error message if generation fails.
///
pub fn main() {
pub(crate) 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 @@ -42,7 +42,7 @@ use libmake::generator::generate_from_yaml;
///
/// * `Result<(), String>` - Returns `Ok(())` if the template files are generated successfully, or returns an error message if there is an error during generation.
///
pub fn main() {
pub(crate) 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 @@ -47,7 +47,7 @@ use libmake::utils::get_csv_field;
///
/// String containing the requested field
///
pub fn main() {
pub(crate) fn main() {
// Retrieve CSV field
let file_path = "../tests/data/mylibrary.csv";
println!(
Expand Down
Loading
Loading