Make gen-dev-cargo-toml a separate package

so that `cargo install` only installs `rustlings`
This commit is contained in:
mo8it 2024-04-04 23:16:57 +02:00
parent 34375b2ebf
commit 445441ce25
6 changed files with 36 additions and 9 deletions

9
Cargo.lock generated
View file

@ -330,6 +330,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "gen-dev-cargo-toml"
version = "0.0.0"
dependencies = [
"anyhow",
"serde",
"toml_edit",
]
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.1"

View file

@ -6,6 +6,9 @@ exclude = [
"tests/fixture/success", "tests/fixture/success",
"dev", "dev",
] ]
members = [
"gen-dev-cargo-toml",
]
[workspace.package] [workspace.package]
version = "6.0.0" version = "6.0.0"
@ -16,6 +19,11 @@ authors = [
license = "MIT" license = "MIT"
edition = "2021" 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] [package]
name = "rustlings" name = "rustlings"
description = "Small exercises to get you used to reading and writing Rust code!" description = "Small exercises to get you used to reading and writing Rust code!"
@ -26,7 +34,7 @@ license.workspace = true
edition.workspace = true edition.workspace = true
[dependencies] [dependencies]
anyhow = "1.0.81" anyhow.workspace = true
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.4", features = ["derive"] }
console = "0.15.8" console = "0.15.8"
crossterm = "0.27.0" crossterm = "0.27.0"
@ -34,8 +42,8 @@ notify-debouncer-mini = "0.4.1"
ratatui = "0.26.1" ratatui = "0.26.1"
rustlings-macros = { path = "rustlings-macros" } rustlings-macros = { path = "rustlings-macros" }
serde_json = "1.0.115" serde_json = "1.0.115"
serde = { version = "1.0.197", features = ["derive"] } serde.workspace = true
toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] } toml_edit.workspace = true
which = "6.0.1" which = "6.0.1"
winnow = "0.6.5" winnow = "0.6.5"

View file

@ -1,5 +1,5 @@
# This file is a hack to allow using `cargo r` to test `rustlings` during development. # 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 --bin gen-dev-cargo-toml`. # You shouldn't edit it manually. It is created and updated by running `cargo run -p gen-dev-cargo-toml`.
bin = [ bin = [
{ name = "intro1", path = "../exercises/00_intro/intro1.rs" }, { name = "intro1", path = "../exercises/00_intro/intro1.rs" },

View file

@ -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

View file

@ -1,5 +1,5 @@
// Generates `dev/Cargo.toml` such that it is synced with `info.toml`. // 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. // during development.
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
@ -30,8 +30,8 @@ fn main() -> Result<()> {
let mut buf = Vec::with_capacity(1 << 14); let mut buf = Vec::with_capacity(1 << 14);
buf.extend_from_slice( buf.extend_from_slice(
b"# This file is a hack to allow using `cargo r` to test `rustlings` during development. 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 --bin gen-dev-cargo-toml`. # You shouldn't edit it manually. It is created and updated by running `cargo run -p gen-dev-cargo-toml`.
bin = [\n", bin = [\n",
); );

View file

@ -1,5 +1,5 @@
// Makes sure that `dev/Cargo.toml` is synced with `info.toml`. // 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 serde::Deserialize;
use std::fs; use std::fs;