From 208990173949c5211906c16453e7701d9fb98d0c Mon Sep 17 00:00:00 2001 From: liv <819880950@qq.com> Date: Sun, 9 Jun 2019 14:46:38 +0200 Subject: [PATCH] docs: Move content from Readme to Contributing --- CONTRIBUTING.md | 30 ++++++++++++++++++++++++++++++ README.md | 26 +------------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84b8bb0..98deb16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,8 @@ First off, thanks for taking the time to contribute!! ❤️ I want to... +_add an exercise! ➡️ [read this](#addex) and then [open a Pull Request](#prs)_ + _update an outdated exercise! ➡️ [open a Pull Request](#prs)_ _report a bug! ➡️ [open an Issue](#issues)_ @@ -14,6 +16,34 @@ _fix a bug! ➡️ [open a Pull Request](#prs)_ _implement a new feature! ➡️ [open an Issue to discuss it first, then a Pull Request](#issues)_ + +### Working on the source code + +`rustlings` is basically a glorified `rustc` wrapper. Therefore the source code +isn't really that complicated since the bulk of the work is done by `rustc`. +`src/main.rs` contains a simple `clap` CLI that loads from `src/verify.rs` and `src/run.rs`. + + +### Adding an exercise + +First step is to add the exercise! Call it `exercises/yourTopic/yourTopicN.rs`, make sure to +put in some helpful links, and link to sections of the book in `exercises/yourTopic/README.md`. + +Next you want to make sure it runs when using `rustlings`. All exercises are stored in `info.toml`, under the `exercises` array. They're ordered by the order they're ran when using `rustlings verify`. + +You want to make sure where in the file you add your exercise. If you're not sure, add it at the bottom and ask in your pull request. To add an exercise, edit the file like this: +```diff + ... ++ [[exercises]] ++ path = "exercises/yourTopic/yourTopicN.rs" ++ mode = "compile" + ... +``` + +The `mode` attribute decides whether Rustlings will only compile your exercise, or compile and test it. If you have tests to verify in your exercise, choose `test`, otherwise `compile`. + +That's all! Feel free to put up a pull request. + ### Issues diff --git a/README.md b/README.md index 7cd22c4..18f3371 100644 --- a/README.md +++ b/README.md @@ -94,31 +94,7 @@ If you are interested in improving or adding new ones, please feel free to contr ## Contributing -### Adding an exercise - -First step is to add the exercise! Call it `exercises/yourTopic/yourTopicN.rs`, make sure to -put in some helpful links, and link to sections of the book in `exercises/yourTopic/README.md`. - -Next you want to make sure it runs when using `rustlings`. All exercises are stored in `info.toml`, under the `exercises` array. They're ordered by the order they're ran when using `rustlings verify`. - -You want to make sure where in the file you add your exercise. If you're not sure, add it at the bottom and ask in your pull request. To add an exercise, edit the file like this: -```diff - ... -+ [[exercises]] -+ path = "exercises/yourTopic/yourTopicN.rs" -+ mode = "compile" - ... -``` - -The `mode` attribute decides whether Rustlings will only compile your exercise, or compile and test it. If you have tests to verify in your exercise, choose `test`, otherwise `compile`. - -That's all! Feel free to put up a pull request. - -### Working on the source code - -`rustlings` is basically a glorified `rustc` wrapper. Therefore the source code -isn't really that complicated since the bulk of the work is done by `rustc`. -`src/main.rs` contains a simple `clap` CLI that loads from `src/verify.rs` and `src/run.rs`. +See [CONTRIBUTING.md](./CONTRIBUTING.md). ## Credits