Skip to content

Commit 3f9fcf3

Browse files
committed
new cunew workflows
1 parent a141acb commit 3f9fcf3

3 files changed

Lines changed: 18 additions & 28 deletions

File tree

book/src/ch03-setup.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Setting Up Your Environment
22

3-
Before we can build a Copper project, we need Rust and the Copper project template.
3+
Before we can build a Copper project, we need Rust 1.95 or newer and the Copper project
4+
bootstrap tool.
45

56
## Install Rust
67

@@ -10,34 +11,27 @@ Follow the official installation guide at <https://rust-lang.org/tools/install/>
1011
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
1112
```
1213

13-
After installation, make sure `cargo` is available:
14+
After installation, make sure `cargo` is available and recent enough:
1415

1516
```bash
1617
cargo --version
18+
rustc --version
1719
```
1820

19-
## Install cargo-generate
21+
## Install cargo-cunew
2022

21-
`cargo-generate` lets you scaffold a new Copper project from the official template:
23+
`cargo-cunew` scaffolds a new Copper project from the official Copper templates:
2224

2325
```bash
24-
cargo install cargo-generate
26+
cargo install cargo-cunew
2527
```
2628

2729
## Generate our first simple Copper project
2830

29-
Clone the copper-rs repository and use the built-in template tool:
31+
Generate a new project directly:
3032

3133
```bash
32-
git clone https://github.com/copper-project/copper-rs
33-
cd copper-rs/templates
34-
35-
cargo +stable generate \
36-
--path cu_project \
37-
--name my_project \
38-
--destination . \
39-
--define copper_source=local \
40-
--define copper_root_path=../..
34+
cargo cunew my_project
4135
```
4236

4337
This generates a complete, ready-to-compile Copper project at the path you specify.
@@ -77,4 +71,4 @@ It will compile and run, and you'll start to receive some messages:
7771
00:00:01.1781 [Debug] Sink Received message: 43
7872
```
7973

80-
Kill the process and let's move to the next chapter.
74+
Kill the process and let's move to the next chapter.

book/src/ch15-workspace.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ generate one and understand its layout.
1111

1212
## Generating a workspace
1313

14-
From the `templates/` directory inside the copper-rs repository, run:
14+
Use `cargo-cunew` with the workspace template:
1515

1616
```bash
17-
cargo +stable generate \
18-
--path cu_full \
19-
--name my_workspace \
20-
--destination . \
21-
--define copper_source=local \
22-
--define copper_root_path=../..
17+
cargo cunew --template workspace my_workspace
2318
```
2419

2520
This creates a `my_workspace/` directory with a full workspace layout.
@@ -72,7 +67,7 @@ resolver = "2"
7267
cu29 = { path = "../../core/cu29" }
7368
cu29-export = { path = "../../core/cu29_export" }
7469
bincode = { package = "cu-bincode", version = "2.0", default-features = false, features = ["derive", "alloc"] }
75-
serde = { version = "*", features = ["derive"] }
70+
serde = { version = "1.0", features = ["derive"] }
7671
```
7772

7873
Every crate in the workspace references these shared dependencies with

book/src/ch21-resources.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,18 @@ cargo run -p cu_missions
4747
## Project templates
4848

4949
We used `cu_project` (Chapter 3) and `cu_full` (Chapter 15) to scaffold our projects, but
50-
the templates directory has more to offer:
50+
the bundled template tree has more to offer:
5151

5252
```text
53-
templates/
53+
support/cargo_cunew/templates/
5454
├── cu_project/ # Simple single-crate project
5555
├── cu_full/ # Multi-crate workspace with components
5656
└── README.md # Detailed usage guide
5757
```
5858

59-
The `templates/README.md` documents all available `cargo generate` options, including how
60-
to use the `cunew` alias and the `just gen-workspace` / `just gen-project` shortcuts.
59+
The `support/cargo_cunew/templates/README.md` guide documents both `cargo cunew` and the
60+
direct `cargo generate` developer path, including the `just gen-workspace` / `just gen-project`
61+
shortcuts for template work inside the repo.
6162

6263
## Docker images
6364

0 commit comments

Comments
 (0)