-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Clap v4 and updated ther dependencies (#43) Updated `clap` to use version 4 and thus removed some unwanted dependencies such as `structopt` and `buildstructor` Also updated all dependencies to their latest minor versions. * Better support for 'building' `Opts` structure. Added `default` derive on the `Opts` structure and a bunch of public methods to set various attributes of the `Opts` structure. Thus `Opts` structure can now be created using `Opts::parse` or using `Opts::default` and then can be updated using `builder` pattern. Also added documentation and unit tests for building `Opts` structure. Changed the example to use the `builder` pattern from original `parse_from` based derive. * Public APIs to use `Into` and `builder` function All the public API functions were using `&str`, which is not wrong per se, but even better approach is to use an `Into` for the public API. Updated public APIs to use this. Also added a `builder` function as using `default` may not be obvious, but a documented `builder` API is a good choice.
- Loading branch information
Showing
5 changed files
with
221 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,28 @@ name = "cargo-scaffold" | |
version = "0.8.14" | ||
authors = ["Benjamin Coenen <[email protected]>"] | ||
edition = "2021" | ||
description = "cargo scaffold lets you scaffold and generate an entire stack based on a simple toml file and make templating into your templates" | ||
description = "Scaffold and generate an entire stack using a simple toml config file and 'handlebars' templates." | ||
license-file = "LICENSE" | ||
readme = "README.md" | ||
repository = "https://github.com/iomentum/cargo-scaffold" | ||
keywords = ["scaffold", "generate", "cargo", "templating"] | ||
|
||
[dependencies] | ||
anyhow = "1.0.32" | ||
auth-git2 = "0.4.0" | ||
clap = "2.33.3" | ||
serde = { version = "1.0.115", features = ["derive"] } | ||
dialoguer = "0.6.2" | ||
handlebars = "4.2" | ||
walkdir = "2.3.1" | ||
toml = "0.5.6" | ||
anyhow = "1.0" | ||
auth-git2 = "0.5" | ||
clap = { version = "4.4", features = ["derive"]} | ||
serde = { version = "1.0", features = ["derive"] } | ||
dialoguer = "0.11" | ||
handlebars = "4.5" | ||
walkdir = "2.4" | ||
toml = "0.8" | ||
git2 = { version = "0.17", features = ["vendored-openssl"] } | ||
md5 = "0.7.0" | ||
md5 = "0.7" | ||
handlebars_misc_helpers = { version = "0.12", default-features = false, features = ["string", "http_attohttpc", "json"], optional = true } | ||
indicatif = "0.15.0" | ||
console = "0.12.0" | ||
globset = "0.4.5" | ||
indicatif = "0.17" | ||
console = "0.15" | ||
globset = "0.4" | ||
shell-words = "1.0" | ||
structopt = "0.3" | ||
buildstructor = "0.5.4" | ||
|
||
[[bin]] | ||
path = "src/main.rs" | ||
|
@@ -37,4 +35,4 @@ default = ["helpers"] | |
helpers = ["handlebars_misc_helpers"] | ||
|
||
[dev-dependencies] | ||
tempfile = "3.7.1" | ||
tempfile = "3.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
use std::path::PathBuf; | ||
|
||
use anyhow::Result; | ||
use cargo_scaffold::{Opts, ScaffoldDescription}; | ||
use toml::Value; | ||
|
||
use cargo_scaffold::{Opts, ScaffoldDescription}; | ||
fn main() -> Result<()> { | ||
let opts = Opts::builder() | ||
.project_name(String::from("testlib")) | ||
.template_path(PathBuf::from( | ||
"https://github.com/Cosmian/mpc_rust_template.git", | ||
)) | ||
.build(); | ||
// let mut params = BTreeMap::new(); | ||
// params.insert("players_nb".to_string(), Value::Integer(3)); | ||
let opts = Opts::default() | ||
.project_name("testlib") | ||
.template_path("https://github.com/Cosmian/mpc_rust_template.git"); | ||
|
||
let scaffold_desc = ScaffoldDescription::new(opts)?; | ||
|
||
let mut params = scaffold_desc.fetch_parameters_value()?; | ||
params.insert("players_nb".to_string(), Value::Integer(3)); | ||
|
||
scaffold_desc.scaffold_with_parameters(params) | ||
// .scaffold_with_parameters(params) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[toolchain] | ||
channel = "1.66" | ||
channel = "stable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.