summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-04 23:16:57 +0200
committermo8it <mo8it@proton.me>2024-04-04 23:16:57 +0200
commit445441ce25ec8658bcdec6b2038d17e893a5903f (patch)
treeb930469e506939e69409587c778a0fc788f73728
parent34375b2ebfbdb0b6504a56c82635c8c9d3d6ce59 (diff)
Make gen-dev-cargo-toml a separate package
so that `cargo install` only installs `rustlings`
-rw-r--r--Cargo.lock9
-rw-r--r--Cargo.toml14
-rw-r--r--dev/Cargo.toml4
-rw-r--r--gen-dev-cargo-toml/Cargo.toml10
-rw-r--r--gen-dev-cargo-toml/src/main.rs (renamed from src/bin/gen-dev-cargo-toml.rs)6
-rw-r--r--tests/dev_cargo_bins.rs2
6 files changed, 36 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4aaec38..e03980c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -331,6 +331,15 @@ dependencies = [
]
[[package]]
+name = "gen-dev-cargo-toml"
+version = "0.0.0"
+dependencies = [
+ "anyhow",
+ "serde",
+ "toml_edit",
+]
+
+[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 3c18741..d80550a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,6 +6,9 @@ exclude = [
"tests/fixture/success",
"dev",
]
+members = [
+ "gen-dev-cargo-toml",
+]
[workspace.package]
version = "6.0.0"
@@ -16,6 +19,11 @@ authors = [
license = "MIT"
edition = "2021"
+[workspace.dependencies]
+anyhow = "1.0.81"
+serde = { version = "1.0.197", features = ["derive"] }
+toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] }
+
[package]
name = "rustlings"
description = "Small exercises to get you used to reading and writing Rust code!"
@@ -26,7 +34,7 @@ license.workspace = true
edition.workspace = true
[dependencies]
-anyhow = "1.0.81"
+anyhow.workspace = true
clap = { version = "4.5.4", features = ["derive"] }
console = "0.15.8"
crossterm = "0.27.0"
@@ -34,8 +42,8 @@ notify-debouncer-mini = "0.4.1"
ratatui = "0.26.1"
rustlings-macros = { path = "rustlings-macros" }
serde_json = "1.0.115"
-serde = { version = "1.0.197", features = ["derive"] }
-toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] }
+serde.workspace = true
+toml_edit.workspace = true
which = "6.0.1"
winnow = "0.6.5"
diff --git a/dev/Cargo.toml b/dev/Cargo.toml
index 7868b97..ed9b3ed 100644
--- a/dev/Cargo.toml
+++ b/dev/Cargo.toml
@@ -1,5 +1,5 @@
-# This file is a hack to allow using `cargo r` to test `rustlings` during development.
-# You shouldn't edit it manually. It is created and updated by running `cargo run --bin gen-dev-cargo-toml`.
+# This file is a hack to allow using `cargo run` to test `rustlings` during development.
+# You shouldn't edit it manually. It is created and updated by running `cargo run -p gen-dev-cargo-toml`.
bin = [
{ name = "intro1", path = "../exercises/00_intro/intro1.rs" },
diff --git a/gen-dev-cargo-toml/Cargo.toml b/gen-dev-cargo-toml/Cargo.toml
new file mode 100644
index 0000000..8922ae8
--- /dev/null
+++ b/gen-dev-cargo-toml/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "gen-dev-cargo-toml"
+publish = false
+license.workspace = true
+edition.workspace = true
+
+[dependencies]
+anyhow.workspace = true
+serde.workspace = true
+toml_edit.workspace = true
diff --git a/src/bin/gen-dev-cargo-toml.rs b/gen-dev-cargo-toml/src/main.rs
index ff8f31d..622762a 100644
--- a/src/bin/gen-dev-cargo-toml.rs
+++ b/gen-dev-cargo-toml/src/main.rs
@@ -1,5 +1,5 @@
// Generates `dev/Cargo.toml` such that it is synced with `info.toml`.
-// `dev/Cargo.toml` is a hack to allow using `cargo r` to test `rustlings`
+// `dev/Cargo.toml` is a hack to allow using `cargo run` to test `rustlings`
// during development.
use anyhow::{bail, Context, Result};
@@ -30,8 +30,8 @@ fn main() -> Result<()> {
let mut buf = Vec::with_capacity(1 << 14);
buf.extend_from_slice(
- b"# This file is a hack to allow using `cargo r` to test `rustlings` during development.
-# You shouldn't edit it manually. It is created and updated by running `cargo run --bin gen-dev-cargo-toml`.
+ b"# This file is a hack to allow using `cargo run` to test `rustlings` during development.
+# You shouldn't edit it manually. It is created and updated by running `cargo run -p gen-dev-cargo-toml`.
bin = [\n",
);
diff --git a/tests/dev_cargo_bins.rs b/tests/dev_cargo_bins.rs
index 7f1771b..ad4832f 100644
--- a/tests/dev_cargo_bins.rs
+++ b/tests/dev_cargo_bins.rs
@@ -1,5 +1,5 @@
// Makes sure that `dev/Cargo.toml` is synced with `info.toml`.
-// When this test fails, you just need to run `cargo run --bin gen-dev-cargo-toml`.
+// When this test fails, you just need to run `cargo run -p gen-dev-cargo-toml`.
use serde::Deserialize;
use std::fs;